summaryrefslogtreecommitdiff
path: root/src/chunk.c
diff options
context:
space:
mode:
authorKrzysztof Krzyżaniak <eloy@debian.org>2006-09-25 08:27:05 +0000
committerKrzysztof Krzyżaniak <eloy@debian.org>2006-09-25 08:27:05 +0000
commitcb3017146d5322069fe4003ffcd4c9ada74dacb8 (patch)
tree5a07eefc6cfd6c668292bfa3471d993dc3b88f1f /src/chunk.c
parent8e8fd7ec0fc30c1703a192edfceefac6ab5f0f0c (diff)
downloadlighttpd-cb3017146d5322069fe4003ffcd4c9ada74dacb8.tar.gz
eloy: new upstream version
Diffstat (limited to 'src/chunk.c')
-rw-r--r--src/chunk.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/chunk.c b/src/chunk.c
index 3903428..776d59e 100644
--- a/src/chunk.c
+++ b/src/chunk.c
@@ -194,6 +194,22 @@ int chunkqueue_append_buffer(chunkqueue *cq, buffer *mem) {
return 0;
}
+int chunkqueue_append_buffer_weak(chunkqueue *cq, buffer *mem) {
+ chunk *c;
+
+ if (mem->used == 0) return 0;
+
+ c = chunkqueue_get_unused_chunk(cq);
+ c->type = MEM_CHUNK;
+ c->offset = 0;
+ if (c->mem) buffer_free(c->mem);
+ c->mem = mem;
+
+ chunkqueue_append_chunk(cq, c);
+
+ return 0;
+}
+
int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) {
chunk *c;
@@ -209,6 +225,7 @@ int chunkqueue_prepend_buffer(chunkqueue *cq, buffer *mem) {
return 0;
}
+
int chunkqueue_append_mem(chunkqueue *cq, const char * mem, size_t len) {
chunk *c;
@@ -355,7 +372,7 @@ int chunkqueue_remove_finished_chunks(chunkqueue *cq) {
switch (c->type) {
case MEM_CHUNK:
- if (c->offset == (off_t)c->mem->used - 1) is_finished = 1;
+ if (c->mem->used == 0 || (c->offset == (off_t)c->mem->used - 1)) is_finished = 1;
break;
case FILE_CHUNK:
if (c->offset == c->file.length) is_finished = 1;