--- libghttp-1.0.9~/http_resp.c 2001-01-23 00:32:15 +0000 +++ libghttp-1.0.9/http_resp.c 2004-05-15 08:58:20 +0000 @@ -634,6 +634,14 @@ flush_response_body(http_resp *a_resp, free(a_resp->body); } a_resp->flushed_length += a_resp->body_len; + if (a_resp->body_state == http_resp_body_read_chunked) + { + a_resp->body_len = 0; + a_resp->body = NULL; + /* leave conn buffer alone (can't just copy it with chunked encoding) */ + } + else + { a_resp->body_len = a_conn->io_buf_alloc; a_resp->body = malloc(a_conn->io_buf_alloc + 1); memset(a_resp->body, 0, a_conn->io_buf_alloc + 1); @@ -641,6 +649,7 @@ flush_response_body(http_resp *a_resp, /* clean the buffer */ http_trans_buf_reset(a_conn); } +} void http_resp_flush(http_resp *a_resp, --- libghttp-1.0.9~/http_trans.c 1998-12-07 22:18:58 +0000 +++ libghttp-1.0.9/http_trans.c 2004-05-15 08:58:20 +0000 @@ -176,9 +176,8 @@ http_trans_read_into_buf(http_trans_conn /* make sure there's enough space */ if (http_trans_buf_free(a_conn) < a_conn->io_buf_io_left) { - a_conn->io_buf = realloc(a_conn->io_buf, - a_conn->io_buf_len + a_conn->io_buf_io_left); - a_conn->io_buf_len += a_conn->io_buf_io_left; + a_conn->io_buf_len = a_conn->io_buf_alloc + a_conn->io_buf_io_left; + a_conn->io_buf = realloc(a_conn->io_buf, a_conn->io_buf_len); } /* check to see how much we should try to read */ if (a_conn->io_buf_io_left > a_conn->io_buf_chunksize)