diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/content_encoding.c | 10 | ||||
-rw-r--r-- | lib/content_encoding.h | 6 | ||||
-rw-r--r-- | lib/http.c | 3 |
3 files changed, 18 insertions, 1 deletions
diff --git a/lib/content_encoding.c b/lib/content_encoding.c index 411f21337..08cf1dccc 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -414,4 +414,14 @@ Curl_unencode_gzip_write(struct connectdata *conn, return inflate_stream(conn, k); #endif } + +void Curl_unencode_cleanup(struct connectdata *conn) +{ + struct SessionHandle *data = conn->data; + struct SingleRequest *k = &data->req; + z_stream *z = &k->z; + if(k->zlib_init != ZLIB_UNINIT) + (void) exit_zlib(z, &k->zlib_init, CURLE_OK); +} + #endif /* HAVE_LIBZ */ diff --git a/lib/content_encoding.h b/lib/content_encoding.h index aa51420db..5e1db65a7 100644 --- a/lib/content_encoding.h +++ b/lib/content_encoding.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -29,8 +29,11 @@ */ #ifdef HAVE_LIBZ #define ALL_CONTENT_ENCODINGS "deflate, gzip" +/* force a cleanup */ +void Curl_unencode_cleanup(struct connectdata *conn); #else #define ALL_CONTENT_ENCODINGS "identity" +#define Curl_unencode_cleanup(x) #endif CURLcode Curl_unencode_deflate_write(struct connectdata *conn, @@ -42,4 +45,5 @@ Curl_unencode_gzip_write(struct connectdata *conn, struct SingleRequest *k, ssize_t nread); + #endif diff --git a/lib/http.c b/lib/http.c index 9c020396c..a17c6eba9 100644 --- a/lib/http.c +++ b/lib/http.c @@ -97,6 +97,7 @@ #include "strtoofft.h" #include "multiif.h" #include "rawstr.h" +#include "content_encoding.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -1917,6 +1918,8 @@ CURLcode Curl_http_done(struct connectdata *conn, struct HTTP *http =data->state.proto.http; (void)premature; /* not used */ + Curl_unencode_cleanup(conn); + /* set the proper values (possibly modified on POST) */ conn->fread_func = data->set.fread_func; /* restore */ conn->fread_in = data->set.in; /* restore */ |