Author: markt
Date: Thu Oct 22 18:48:35 2015
New Revision: 1710074
URL: http://svn.apache.org/viewvc?rev=1710074&view=rev
Log:
Improve debug logging for connection settings (include the connection ID)
Modified:
tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsBase.java
tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsLocal.java
tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsRemote.java
tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties
tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
Modified: tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsBase.java?rev=1710074&r1=1710073&r2=1710074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsBase.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsBase.java Thu
Oct 22 18:48:35 2015
@@ -28,6 +28,8 @@ public abstract class ConnectionSettings
private final Log log = LogFactory.getLog(ConnectionSettingsBase.class);
private final StringManager sm =
StringManager.getManager(ConnectionSettingsBase.class);
+ private final String connectionId;
+
// Limits
protected static final int MAX_WINDOW_SIZE = (1 << 31) - 1;
protected static final int MIN_MAX_FRAME_SIZE = 1 << 14;
@@ -46,7 +48,8 @@ public abstract class ConnectionSettings
protected Map<Setting,Long> pending = new HashMap<>();
- public ConnectionSettingsBase() {
+ public ConnectionSettingsBase(String connectionId) {
+ this.connectionId = connectionId;
// Set up the defaults
current.put(Setting.HEADER_TABLE_SIZE,
Long.valueOf(DEFAULT_HEADER_TABLE_SIZE));
current.put(Setting.ENABLE_PUSH,
Long.valueOf(DEFAULT_ENABLE_PUSH ? 1 : 0));
@@ -59,7 +62,8 @@ public abstract class ConnectionSettings
public void set(Setting setting, long value) throws T {
if (log.isDebugEnabled()) {
- log.debug(sm.getString("connectionSettings.debug", setting,
Long.toString(value)));
+ log.debug(sm.getString("connectionSettings.debug",
+ connectionId, setting, Long.toString(value)));
}
switch(setting) {
@@ -83,7 +87,8 @@ public abstract class ConnectionSettings
break;
case UNKNOWN:
// Unrecognised. Ignore it.
- log.warn(sm.getString("connectionSettings.unknown", setting,
Long.toString(value)));
+ log.warn(sm.getString("connectionSettings.unknown",
+ connectionId, setting, Long.toString(value)));
return;
}
@@ -173,7 +178,7 @@ public abstract class ConnectionSettings
// Need to put a sensible limit on this. Start with 16k (default is 4k)
if (headerTableSize > (16 * 1024)) {
String msg =
sm.getString("connectionSettings.headerTableSizeLimit",
- Long.toString(headerTableSize));
+ connectionId, Long.toString(headerTableSize));
throwException(msg, Http2Error.PROTOCOL_ERROR);
}
}
@@ -184,7 +189,7 @@ public abstract class ConnectionSettings
// will never be negative
if (enablePush > 1) {
String msg = sm.getString("connectionSettings.enablePushInvalid",
- Long.toString(enablePush));
+ connectionId, Long.toString(enablePush));
throwException(msg, Http2Error.PROTOCOL_ERROR);
}
}
@@ -193,7 +198,7 @@ public abstract class ConnectionSettings
private void validateInitialWindowSize(long initialWindowSize) throws T {
if (initialWindowSize > MAX_WINDOW_SIZE) {
String msg = sm.getString("connectionSettings.windowSizeTooBig",
- Long.toString(initialWindowSize),
Long.toString(MAX_WINDOW_SIZE));
+ connectionId, Long.toString(initialWindowSize),
Long.toString(MAX_WINDOW_SIZE));
throwException(msg, Http2Error.FLOW_CONTROL_ERROR);
}
}
@@ -202,7 +207,7 @@ public abstract class ConnectionSettings
private void validateMaxFrameSize(long maxFrameSize) throws T {
if (maxFrameSize < MIN_MAX_FRAME_SIZE || maxFrameSize >
MAX_MAX_FRAME_SIZE) {
String msg = sm.getString("connectionSettings.maxFrameSizeInvalid",
- Long.toString(maxFrameSize),
Integer.toString(MIN_MAX_FRAME_SIZE),
+ connectionId, Long.toString(maxFrameSize),
Integer.toString(MIN_MAX_FRAME_SIZE),
Integer.toString(MAX_MAX_FRAME_SIZE));
throwException(msg, Http2Error.PROTOCOL_ERROR);
}
Modified: tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsLocal.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsLocal.java?rev=1710074&r1=1710073&r2=1710074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsLocal.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsLocal.java Thu
Oct 22 18:48:35 2015
@@ -34,6 +34,12 @@ public class ConnectionSettingsLocal ext
private boolean sendInProgress = false;
+
+ public ConnectionSettingsLocal(String connectionId) {
+ super(connectionId);
+ }
+
+
@Override
protected synchronized void set(Setting setting, Long value) {
checkSend();
Modified:
tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsRemote.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsRemote.java?rev=1710074&r1=1710073&r2=1710074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsRemote.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/ConnectionSettingsRemote.java Thu
Oct 22 18:48:35 2015
@@ -22,6 +22,11 @@ package org.apache.coyote.http2;
*/
public class ConnectionSettingsRemote extends
ConnectionSettingsBase<ConnectionException> {
+ public ConnectionSettingsRemote(String connectionId) {
+ super(connectionId);
+ }
+
+
@Override
void throwException(String msg, Http2Error error) throws
ConnectionException {
throw new ConnectionException(msg, error);
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=1710074&r1=1710073&r2=1710074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java
(original)
+++ tomcat/trunk/java/org/apache/coyote/http2/Http2UpgradeHandler.java Thu Oct
22 18:48:35 2015
@@ -116,12 +116,12 @@ public class Http2UpgradeHandler extends
* Remote settings are settings defined by the client and sent to Tomcat
* that Tomcat must use when communicating with the client.
*/
- private final ConnectionSettingsRemote remoteSettings = new
ConnectionSettingsRemote();
+ private final ConnectionSettingsRemote remoteSettings;
/**
* Local settings are settings defined by Tomcat and sent to the client
that
* the client must use when communicating with Tomcat.
*/
- private final ConnectionSettingsLocal localSettings = new
ConnectionSettingsLocal();
+ private final ConnectionSettingsLocal localSettings;
private HpackDecoder hpackDecoder;
private HpackEncoder hpackEncoder;
@@ -150,6 +150,9 @@ public class Http2UpgradeHandler extends
this.adapter = adapter;
this.connectionId =
Integer.toString(connectionIdGenerator.getAndIncrement());
+ remoteSettings = new ConnectionSettingsRemote(connectionId);
+ localSettings = new ConnectionSettingsLocal(connectionId);
+
// Initial HTTP request becomes stream 1.
if (coyoteRequest != null) {
if (log.isDebugEnabled()) {
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=1710074&r1=1710073&r2=1710074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/LocalStrings.properties Thu Oct
22 18:48:35 2015
@@ -21,12 +21,12 @@ connectionPrefaceParser.eos=Unexpected e
connectionPrefaceParser.ioError=Failed to read opening client preface byte
sequence
connectionPrefaceParser.mismatch=An unexpected byte sequence was received at
the start of the client preface [{0}]
-connectionSettings.debug=Parameter type [{0}] set to [{1}]
-connectionSettings.enablePushInvalid=The requested value for enable push [{0}]
is not one of the permitted values (zero or one)
-connectionSettings.headerTableSizeLimit=Attempted to set a header table size
of [{0}] but the limit is 16k
-connectionSettings.maxFrameSizeInvalid=The requested maximum frame size of
[{0}] is ouside the permitted range of [{1}] to [{2}]
-connectionSettings.unknown=An unknown setting with identifier [{0}] and value
[{1}] was ignored
-connectionSettings.windowSizeTooBig=The requested window size of [{0}] is
bigger than the maximum permitted value of [{1}]
+connectionSettings.debug=Connection [{0}], Parameter type [{1}] set to [{2}]
+connectionSettings.enablePushInvalid=Connection [{0}], The requested value for
enable push [{1}] is not one of the permitted values (zero or one)
+connectionSettings.headerTableSizeLimit=Connection [{0}], Attempted to set a
header table size of [{1}] but the limit is 16k
+connectionSettings.maxFrameSizeInvalid=Connection [{0}], The requested maximum
frame size of [{1}] is outside the permitted range of [{2}] to [{3}]
+connectionSettings.unknown=Connection [{0}], An unknown setting with
identifier [{1}] and value [{2}] was ignored
+connectionSettings.windowSizeTooBig=Connection [{0}], The requested window
size of [{1}] is bigger than the maximum permitted value of [{2}]
frameType.checkPayloadSize=Payload size of [{0}] is not valid for frame type
[{1}]
frameType.checkStream=Invalid frame type [{0}]
Modified: tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java?rev=1710074&r1=1710073&r2=1710074&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http2/Http2TestBase.java Thu Oct 22
18:48:35 2015
@@ -717,7 +717,7 @@ public abstract class Http2TestBase exte
private StringBuffer trace = new StringBuffer();
private String lastStreamId = "0";
- private ConnectionSettingsRemote remoteSettings = new
ConnectionSettingsRemote();
+ private ConnectionSettingsRemote remoteSettings = new
ConnectionSettingsRemote("-1");
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]