Changeset 6908616


Ignore:
Timestamp:
Mar 19, 2018 1:47:56 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
bdff474d
Parents:
841bb755
Message:

i2ptunnel: Don't set content-encoding and compress if already set,
no matter what the encoding was, can't have two

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java

    r841bb755 r6908616  
    816816        protected boolean shouldCompress() {
    817817            return (_dataExpected < 0 || _dataExpected >= MIN_TO_COMPRESS) &&
     818                   // must be null as we write the header in finishHeaders(), can't have two
     819                   (_contentEncoding == null) &&
    818820                   (_contentType == null ||
    819821                    ((!_contentType.startsWith("audio/")) &&
     
    826828                     (!_contentType.equals("application/x-bzip2")) &&
    827829                     (!_contentType.equals("application/x-gzip")) &&
    828                      (!_contentType.equals("application/zip")))) &&
    829                    (_contentEncoding == null ||
    830                     ((!_contentEncoding.equals("gzip")) &&
    831                      (!_contentEncoding.equals("compress")) &&
    832                      (!_contentEncoding.equals("deflate"))));
     830                     (!_contentType.equals("application/zip"))));
    833831        }
    834832
    835833        @Override
    836834        protected void finishHeaders() throws IOException {
    837             //if (_log.shouldLog(Log.INFO))
    838             //    _log.info("Including x-i2p-gzip as the content encoding in the response");
     835            // TODO if browser supports gzip, send as gzip
    839836            if (shouldCompress())
    840837                out.write(DataHelper.getASCII("Content-Encoding: x-i2p-gzip\r\n"));
Note: See TracChangeset for help on using the changeset viewer.