1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

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

It lets view the site from bug 1017.
This commit is contained in:
Witold Filipczyk 2009-02-21 12:27:01 +01:00 committed by Witold Filipczyk
parent 391394063f
commit 3131de4767
2 changed files with 4 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

@ -1057,7 +1057,6 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
int *length_of_block;
unsigned char *output = NULL;
if (http->length == LEN_CHUNKED) {
if (http->chunk_remaining == CHUNK_ZERO_SIZE)
state = FINISHING;