Fix "Content-Encoding" header is always created.

Was side effect of operator[]
This commit is contained in:
Chocobo1 2017-04-13 16:20:58 +08:00
parent 7d36c81949
commit 129172453b

View file

@ -37,7 +37,7 @@
QByteArray Http::toByteArray(Response response) QByteArray Http::toByteArray(Response response)
{ {
if (response.headers[HEADER_CONTENT_ENCODING] == "gzip") { if (response.headers.value(HEADER_CONTENT_ENCODING) == "gzip") {
// A gzip seems to have 23 bytes overhead. // A gzip seems to have 23 bytes overhead.
// Also "Content-Encoding: gzip\r\n" is 26 bytes long // Also "Content-Encoding: gzip\r\n" is 26 bytes long
// So we only benefit from gzip if the message is bigger than 23+26 = 49 // So we only benefit from gzip if the message is bigger than 23+26 = 49