I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 6908616a authored by zzz's avatar zzz
Browse files

i2ptunnel: Don't set content-encoding and compress if already set,

no matter what the encoding was, can't have two
parent 841bb755
No related branches found
No related tags found
No related merge requests found
......@@ -815,6 +815,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
@Override
protected boolean shouldCompress() {
return (_dataExpected < 0 || _dataExpected >= MIN_TO_COMPRESS) &&
// must be null as we write the header in finishHeaders(), can't have two
(_contentEncoding == null) &&
(_contentType == null ||
((!_contentType.startsWith("audio/")) &&
(!_contentType.startsWith("image/")) &&
......@@ -825,17 +827,12 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
(!_contentType.equals("application/x-bzip")) &&
(!_contentType.equals("application/x-bzip2")) &&
(!_contentType.equals("application/x-gzip")) &&
(!_contentType.equals("application/zip")))) &&
(_contentEncoding == null ||
((!_contentEncoding.equals("gzip")) &&
(!_contentEncoding.equals("compress")) &&
(!_contentEncoding.equals("deflate"))));
(!_contentType.equals("application/zip"))));
}
@Override
protected void finishHeaders() throws IOException {
//if (_log.shouldLog(Log.INFO))
// _log.info("Including x-i2p-gzip as the content encoding in the response");
// TODO if browser supports gzip, send as gzip
if (shouldCompress())
out.write(DataHelper.getASCII("Content-Encoding: x-i2p-gzip\r\n"));
super.finishHeaders();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment