From 573bd43e0c860733560762ad27d112a5afccc2b8 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Mon, 11 Dec 2006 21:32:14 +0100 Subject: [PATCH] The gzip decompression simplification. gzclearerr does the job. --- src/protocol/http/http.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/protocol/http/http.c b/src/protocol/http/http.c index 31370255..3c52195c 100644 --- a/src/protocol/http/http.c +++ b/src/protocol/http/http.c @@ -1028,30 +1028,17 @@ decompress_data(struct connection *conn, unsigned char *data, int len, } } - if (state == FINISHING) { - /* state is FINISHING. Set to_read to some nice, big - * value to empty the encoded output queue by reading - * big chunks from it. */ - to_read = BIG_READ; - } - if (!conn->stream) { conn->stream = open_encoded(conn->stream_pipes[0], conn->content_encoding); if (!conn->stream) return NULL; - /* On "startup" pipe is treated with care, but if everything - * was already written to the pipe, caution isn't necessary */ - if (state != FINISHING) { - /* on init don't read too much */ - to_read = PIPE_BUF / 32; - } } - output = (unsigned char *) mem_realloc(output, *new_len + to_read); + output = (unsigned char *) mem_realloc(output, *new_len + BIG_READ); if (!output) break; - did_read = read_encoded(conn->stream, output + *new_len, - to_read); + did_read = read_encoded(conn->stream, output + *new_len, BIG_READ); + if (did_read > 0) *new_len += did_read; else if (did_read == -1) { mem_free_set(&output, NULL); -- 2.11.4.GIT