Author: markt Date: Mon Nov 23 12:28:59 2015 New Revision: 1715783 URL: http://svn.apache.org/viewvc?rev=1715783&view=rev Log: HTTP/2 debug logging improvements for Server push
Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties tomcat/trunk/java/org/apache/coyote/http2/Stream.java Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java?rev=1715783&r1=1715782&r2=1715783&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/HpackEncoder.java Mon Nov 23 12:28:59 2015 @@ -26,13 +26,19 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import org.apache.juli.logging.Log; +import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.http.MimeHeaders; +import org.apache.tomcat.util.res.StringManager; /** * Encoder for HPACK frames. */ public class HpackEncoder { + private static final Log log = LogFactory.getLog(HpackEncoder.class); + private static final StringManager sm = StringManager.getManager(HpackEncoder.class); + public static final HpackHeaderFunction DEFAULT_HEADER_FUNCTION = new HpackHeaderFunction() { @Override public boolean shouldUseIndexing(String headerName, String value) { @@ -141,19 +147,24 @@ public class HpackEncoder { } } if (!skip) { - - int required = 11 + headerName.length(); //we use 11 to make sure we have enough room for the variable length integers - String val = headers.getValue(it).toString(); + + if (log.isDebugEnabled()) { + log.debug(sm.getString("hpackEncoder.encodeHeader", headerName, val)); + } TableEntry tableEntry = findInTable(headerName, val); - required += (1 + val.length()); + // We use 11 to make sure we have enough room for the + // variable length integers + int required = 11 + headerName.length() + 1 + val.length(); if (target.remaining() < required) { this.headersIterator = it; return State.UNDERFLOW; } - boolean canIndex = hpackHeaderFunction.shouldUseIndexing(headerName, val) && (headerName.length() + val.length() + 32) < maxTableSize; //only index if it will fit + // Only index if it will fit + boolean canIndex = hpackHeaderFunction.shouldUseIndexing(headerName, val) && + (headerName.length() + val.length() + 32) < maxTableSize; if (tableEntry == null && canIndex) { //add the entry to the dynamic table target.put((byte) (1 << 6)); Modified: tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java?rev=1715783&r1=1715782&r2=1715783&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Mon Nov 23 12:28:59 2015 @@ -551,7 +551,7 @@ public class Http2UpgradeHandler extends throws IOException { if (log.isDebugEnabled()) { log.debug(sm.getString("upgradeHandler.writePushHeaders", connectionId, - stream.getIdentifier())); + stream.getIdentifier(), Integer.toString(pushedStreamId))); } // This ensures the Stream processing thread has control of the socket. synchronized (socketWrapper) { Modified: tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties?rev=1715783&r1=1715782&r2=1715783&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Mon Nov 23 12:28:59 2015 @@ -35,6 +35,8 @@ hpack.integerEncodedOverTooManyOctets=HP hpackdecoder.zeroNotValidHeaderTableIndex=Zero is not a valid header table index +hpackEncoder.encodeHeader=Encoding header [{0}] with value [{1}] + hpackhuffman.huffmanEncodedHpackValueDidNotEndWithEOS=Huffman encoded value in HPACK headers did not end with EOS padding http2Parser.headers.wrongFrameType=Connection [{0}], headers in progress for stream [{1}] but a frame of type [{2}] was received @@ -125,7 +127,7 @@ upgradeHandler.windowSizeTooBig=Connecti upgradeHandler.windowSizeReservationInterrupted=Connection [{0}], Stream [{1}], reservation for [{2}] bytes upgradeHandler.writeBody=Connection [{0}], Stream [{1}], Data length [{2}] upgradeHandler.writeHeaders=Connection [{0}], Stream [{1}] -upgradeHandler.writePushHeaders=Connection [{0}], Stream [{1}] +upgradeHandler.writePushHeaders=Connection [{0}], Stream [{1}], Pushed stream [{2}] writeStateMachine.endWrite.ise=It is illegal to specify [{0}] for the new state once a write has completed writeStateMachine.ise=It is illegal to call [{0}()] in state [{1}] \ No newline at end of file Modified: tomcat/trunk/java/org/apache/coyote/http2/Stream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/Stream.java?rev=1715783&r1=1715782&r2=1715783&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/Stream.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/Stream.java Mon Nov 23 12:28:59 2015 @@ -391,7 +391,7 @@ public class Stream extends AbstractStre // TODO: Handle default ports request.getMimeHeaders().addValue(":authority").setString( request.serverName().getString() + ":" + request.getServerPort()); - push (handler, request, this); + push(handler, request, this); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org