39 #define GZIP_MAGIC_0 0x1f
40 #define GZIP_MAGIC_1 0x8b
43 #define ASCII_FLAG 0x01
45 #define EXTRA_FIELD 0x04
46 #define ORIG_NAME 0x08
54 failf (data,
"Error while processing content unencoding.\n%s",
57 failf (data,
"Error while processing content unencoding.\n"
58 "Unknown failure within decompression software.");
89 return process_zlib_error(data, z);
111 return exit_zlib(z, &k->zlib_init, result);
117 return exit_zlib(z, &k->zlib_init, result);
119 return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
127 return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
144 return GZIP_UNDERFLOW;
146 if ((data[0] != GZIP_MAGIC_0) || (data[1] != GZIP_MAGIC_1))
152 if (method !=
Z_DEFLATED || (flags & RESERVED) != 0) {
161 if (flags & EXTRA_FIELD) {
165 return GZIP_UNDERFLOW;
167 extra_len = (data[1] << 8) | data[0];
169 if (len < (extra_len+2))
170 return GZIP_UNDERFLOW;
172 len -= (extra_len + 2);
175 if (flags & ORIG_NAME) {
177 while (len && *data) {
182 return GZIP_UNDERFLOW;
189 if (flags & COMMENT) {
191 while (len && *data) {
196 return GZIP_UNDERFLOW;
203 if (flags & HEAD_CRC) {
205 return GZIP_UNDERFLOW;
211 *headerlen = totallen -
len;
233 return process_zlib_error(data, z);
244 if (k->zlib_init == 1) {
248 switch (check_gzip_header((
unsigned char *)k->
str, nread, &hlen)) {
274 return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
278 else if (k->zlib_init == 2) {
281 unsigned char *oldblock = z->
next_in;
309 return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
338 return exit_zlib(z, &k->zlib_init, result);
345 return exit_zlib(z, &k->zlib_init, result);
347 return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
355 return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
CURLcode Curl_unencode_gzip_write(struct SessionHandle *data, struct Curl_transfer_keeper *k, ssize_t nread)
CURLcode Curl_unencode_deflate_write(struct SessionHandle *data, struct Curl_transfer_keeper *k, ssize_t nread)
void(* free_func)(void *opaque, void *address)
CURLcode Curl_client_write(struct SessionHandle *data, int type, char *ptr, size_t len)
int inflate(z_streamp z, int f)
GLsizei GLsizei GLenum GLenum const GLvoid * data
#define inflateInit(strm)
int inflateEnd(z_streamp z)
void *(* alloc_func)(void *opaque, unsigned int items, unsigned int size)
#define inflateInit2(strm, windowBits)