mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-22 11:22:38 -04:00
Correctly change the compression buffer we send.
For ie browser, we need to remove the two first bytes. If we make our buffer start two bytes after, we also need to reduce the size of the buffer by two bytes. Else we will read and send two extra junk bytes. Fix #15
This commit is contained in:
parent
0c01ec5bb5
commit
a27010c247
@ -167,7 +167,7 @@ bool compress_content(string &content,
|
||||
comprLen = COMPRESSOR_BUFFER_SIZE;
|
||||
compress(compr, &comprLen, (const Bytef*)(content.data()), contentLength);
|
||||
|
||||
if (comprLen > 2 && comprLen < contentLength) {
|
||||
if (comprLen > 2 && comprLen < (contentLength+2)) {
|
||||
|
||||
/* /!\ Internet Explorer has a bug with deflate compression.
|
||||
It can not handle the first two bytes (compression headers)
|
||||
@ -175,6 +175,7 @@ bool compress_content(string &content,
|
||||
It has no incidence on other browsers
|
||||
See http://www.subbu.org/blog/2008/03/ie7-deflate-or-not and comments */
|
||||
compr += 2;
|
||||
comprLen -= 2;
|
||||
|
||||
content = string((char *)compr, comprLen);
|
||||
contentLength = comprLen;
|
||||
|
Loading…
x
Reference in New Issue
Block a user