Changeset b04924d


Ignore:
Timestamp:
Dec 11, 2017 11:39:58 AM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
789f15f
Parents:
ed4dc33
Message:

Jetty: Fix request log showing zero length for static content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/jetty/java/src/net/i2p/jetty/I2PRequestLog.java

    red4dc33 rb04924d  
    332332
    333333                long responseLength=response.getContentCount();
     334                // The above is what Jetty used before 9, but now
     335                // it often (for large content?) returns 0 for non-cgi responses.
     336                // Now, Jetty uses getLongContentLength(), but according to
     337                // these threads it returns 0 for streaming (cgi) responses.
     338                // So we take whichever one is nonzero, if the result was 200.
     339                // See:
     340                // https://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02261.html
     341                // and followups including this workaround:
     342                // https://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02267.html
     343                if (responseLength == 0 && status == 200 && !"HEAD".equals(request.getMethod()))
     344                    responseLength = response.getLongContentLength();
    334345                if (responseLength >=0)
    335346                {
Note: See TracChangeset for help on using the changeset viewer.