mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Fix WebUI gzip compression. Closes #1037.
This commit is contained in:
parent
ae63830b7d
commit
ade66629b1
@ -35,7 +35,6 @@
|
||||
void HttpResponseGenerator::setMessage(const QByteArray& message)
|
||||
{
|
||||
m_message = message;
|
||||
setContentLength(message.size());
|
||||
}
|
||||
|
||||
void HttpResponseGenerator::setMessage(const QString& message)
|
||||
@ -113,7 +112,7 @@ bool HttpResponseGenerator::gCompress(QByteArray &dest_buffer) {
|
||||
|
||||
if (deflate_res != Z_STREAM_END)
|
||||
return false;
|
||||
dest_buffer.append(tmp_buf, BUFSIZE);
|
||||
dest_buffer.append(tmp_buf, BUFSIZE - strm.avail_out);
|
||||
deflateEnd(&strm);
|
||||
|
||||
return true;
|
||||
@ -123,10 +122,11 @@ QByteArray HttpResponseGenerator::toByteArray() {
|
||||
if (m_gzip) {
|
||||
QByteArray dest_buf;
|
||||
if (gCompress(dest_buf)) {
|
||||
setValue("Content-Encoding", "gzip");
|
||||
setValue("content-encoding", "gzip");
|
||||
m_message.swap(dest_buf);
|
||||
}
|
||||
}
|
||||
|
||||
setContentLength(m_message.size());
|
||||
return QHttpResponseHeader::toString().toUtf8() + m_message;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user