summaryrefslogtreecommitdiff
path: root/src/chunk.c
diff options
context:
space:
mode:
authorArno Töll <arno@debian.org>2012-11-21 23:03:41 +0100
committerArno Töll <arno@debian.org>2012-11-21 23:03:41 +0100
commit6a6df8dc258631c6eaccb03bf08845241f6dfa4a (patch)
tree01eee8de64a85e5e2fef929050663ea2d3c850bd /src/chunk.c
parentec2cb646eff482dfe32955d01781b01211b0a77c (diff)
downloadlighttpd-6a6df8dc258631c6eaccb03bf08845241f6dfa4a.tar.gz
Imported Upstream version 1.4.12upstream/1.4.12
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;