1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Fallback to the raw deflate only when nothing was decompressed so far.

It lets view the site from bug 1017.
(cherry picked from commit 3131de4767)

Conflicts:

	src/protocol/http/http.c
This commit is contained in:
Witold Filipczyk 2009-02-21 14:12:03 +01:00 committed by Witold Filipczyk
parent 53ab6d493e
commit 4a2fd2d964
2 changed files with 6 additions and 3 deletions

View File

@ -124,7 +124,8 @@ deflate_read(struct stream_encoded *stream, unsigned char *buf, int len)
}
restart:
err = inflate(&data->deflate_stream, Z_SYNC_FLUSH);
if (err == Z_DATA_ERROR && !data->after_first_read) {
if (err == Z_DATA_ERROR && !data->after_first_read
&& data->deflate_stream.next_out == buf) {
/* RFC 2616 requires a zlib header for
* "Content-Encoding: deflate", but some HTTP
* servers (Microsoft-IIS/6.0 at blogs.msdn.com,
@ -159,7 +160,8 @@ restart:
data->last_read = 1;
break;
} else if (err != Z_OK) {
return -1;
data->last_read = 1;
break;
}
} while (data->deflate_stream.avail_out > 0);

View File

@ -1012,7 +1012,7 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
int *length_of_block;
unsigned char *output = NULL;
#define BIG_READ 65536
#define BIG_READ 655360
if (http->length == LEN_CHUNKED) {
if (http->chunk_remaining == CHUNK_ZERO_SIZE)
@ -1100,6 +1100,7 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
if (state == FINISHING) shutdown_connection_stream(conn);
return output;
#undef BIG_READ
}
static int