mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
WebUI: Don't gzip too small payloads.
This commit is contained in:
@@ -119,7 +119,11 @@ bool HttpResponseGenerator::gCompress(QByteArray &dest_buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QByteArray HttpResponseGenerator::toByteArray() {
|
QByteArray HttpResponseGenerator::toByteArray() {
|
||||||
if (m_gzip && m_message.size() > 0) {// prevents writing a useless and wasteful header
|
// A gzip seems to have 23 bytes overhead.
|
||||||
|
// 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
|
||||||
|
// If the message is smaller than 49 bytes we actually send MORE data if we gzip
|
||||||
|
if (m_gzip && m_message.size() > 49) {
|
||||||
QByteArray dest_buf;
|
QByteArray dest_buf;
|
||||||
if (gCompress(dest_buf)) {
|
if (gCompress(dest_buf)) {
|
||||||
setValue("content-encoding", "gzip");
|
setValue("content-encoding", "gzip");
|
||||||
|
|||||||
Reference in New Issue
Block a user