mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -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 3131de4767475097eb60bb1641b39e6b647eb289) Conflicts: src/protocol/http/http.c
This commit is contained in:
parent
53ab6d493e
commit
4a2fd2d964
@ -124,7 +124,8 @@ deflate_read(struct stream_encoded *stream, unsigned char *buf, int len)
|
|||||||
}
|
}
|
||||||
restart:
|
restart:
|
||||||
err = inflate(&data->deflate_stream, Z_SYNC_FLUSH);
|
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
|
/* RFC 2616 requires a zlib header for
|
||||||
* "Content-Encoding: deflate", but some HTTP
|
* "Content-Encoding: deflate", but some HTTP
|
||||||
* servers (Microsoft-IIS/6.0 at blogs.msdn.com,
|
* servers (Microsoft-IIS/6.0 at blogs.msdn.com,
|
||||||
@ -159,7 +160,8 @@ restart:
|
|||||||
data->last_read = 1;
|
data->last_read = 1;
|
||||||
break;
|
break;
|
||||||
} else if (err != Z_OK) {
|
} else if (err != Z_OK) {
|
||||||
return -1;
|
data->last_read = 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} while (data->deflate_stream.avail_out > 0);
|
} while (data->deflate_stream.avail_out > 0);
|
||||||
|
|
||||||
|
@ -1012,7 +1012,7 @@ decompress_data(struct connection *conn, unsigned char *data, int len,
|
|||||||
int *length_of_block;
|
int *length_of_block;
|
||||||
unsigned char *output = NULL;
|
unsigned char *output = NULL;
|
||||||
|
|
||||||
#define BIG_READ 65536
|
#define BIG_READ 655360
|
||||||
|
|
||||||
if (http->length == LEN_CHUNKED) {
|
if (http->length == LEN_CHUNKED) {
|
||||||
if (http->chunk_remaining == CHUNK_ZERO_SIZE)
|
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);
|
if (state == FINISHING) shutdown_connection_stream(conn);
|
||||||
return output;
|
return output;
|
||||||
|
#undef BIG_READ
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user