diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java index 0aedb4b0f44..86c6af29736 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ssl/SslBytesServerTest.java @@ -112,7 +112,7 @@ public class SslBytesServerTest extends SslBytesTest @Override public Connection newConnection(Connector connector, EndPoint endPoint) { - return configure(new HttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance()) + return configure(new HttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance(),isRecordHttpComplianceViolations()) { @Override protected HttpParser newHttpParser(HttpCompliance compliance) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java index 4b8c5085478..842a16c17dc 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java @@ -319,7 +319,7 @@ public class HttpParser /* ------------------------------------------------------------------------------- */ protected String legacyString(String orig, String cached) { - return (orig.equals(cached) || complianceViolation(RFC2616,"case sensitive"))?cached:orig; + return (_compliance!=LEGACY || orig.equals(cached) || complianceViolation(RFC2616,"case sensitive"))?cached:orig; } /* ------------------------------------------------------------------------------- */ diff --git a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java index 6a587e37515..57e2de5c569 100644 --- a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java +++ b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/HTTP2CServerTest.java @@ -294,7 +294,7 @@ public class HTTP2CServerTest extends AbstractServerTest @Override public Connection newConnection(Connector connector, EndPoint endPoint) { - HttpConnection connection = new HttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance()) + HttpConnection connection = new HttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance(),isRecordHttpComplianceViolations()) { @Override public void onFillable() diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index 701b7958195..7e636e6d996 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -71,7 +71,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http private final BlockingReadCallback _blockingReadCallback = new BlockingReadCallback(); private final AsyncReadCallback _asyncReadCallback = new AsyncReadCallback(); private final SendCallback _sendCallback = new SendCallback(); - private boolean _recordHttpComplianceViolations = false; + private final boolean _recordHttpComplianceViolations; /** * Get the current connection that this thread is dispatched to. @@ -92,7 +92,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http return last; } - public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpCompliance compliance) + public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpCompliance compliance, boolean recordComplianceViolations) { super(endPoint, connector.getExecutor()); _config = config; @@ -102,6 +102,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http _channel = newHttpChannel(); _input = _channel.getRequest().getHttpInput(); _parser = newHttpParser(compliance); + _recordHttpComplianceViolations=recordComplianceViolations; if (LOG.isDebugEnabled()) LOG.debug("New HTTP Connection {}", this); } @@ -116,11 +117,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http return _recordHttpComplianceViolations; } - public void setRecordHttpComplianceViolations(boolean recordHttpComplianceViolations) - { - this._recordHttpComplianceViolations = recordHttpComplianceViolations; - } - protected HttpGenerator newHttpGenerator() { return new HttpGenerator(_config.getSendServerVersion(),_config.getSendXPoweredBy()); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java index ebd108362ea..1f3fd8482b0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnectionFactory.java @@ -82,8 +82,7 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements @Override public Connection newConnection(Connector connector, EndPoint endPoint) { - HttpConnection conn = new HttpConnection(_config, connector, endPoint, _httpCompliance); - conn.setRecordHttpComplianceViolations(_recordHttpComplianceViolations); + HttpConnection conn = new HttpConnection(_config, connector, endPoint, _httpCompliance,isRecordHttpComplianceViolations()); return configure(conn, connector, endPoint); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ExtendedServerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ExtendedServerTest.java index 78864a78487..710046a8664 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ExtendedServerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ExtendedServerTest.java @@ -55,7 +55,7 @@ public class ExtendedServerTest extends HttpServerTestBase @Override public Connection newConnection(Connector connector, EndPoint endPoint) { - return configure(new ExtendedHttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance()), connector, endPoint); + return configure(new ExtendedHttpConnection(getHttpConfiguration(), connector, endPoint), connector, endPoint); } }) { @@ -93,9 +93,9 @@ public class ExtendedServerTest extends HttpServerTestBase private static class ExtendedHttpConnection extends HttpConnection { - public ExtendedHttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpCompliance compliance) + public ExtendedHttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint) { - super(config,connector,endPoint,compliance); + super(config,connector,endPoint,HttpCompliance.RFC7230,false); } @Override diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java index 5a953e3b1d2..278c5f252d5 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/SlowClientWithPipelinedRequestTest.java @@ -54,7 +54,7 @@ public class SlowClientWithPipelinedRequestTest @Override public Connection newConnection(Connector connector, EndPoint endPoint) { - return configure(new HttpConnection(getHttpConfiguration(),connector,endPoint,getHttpCompliance()) + return configure(new HttpConnection(getHttpConfiguration(),connector,endPoint,getHttpCompliance(),isRecordHttpComplianceViolations()) { @Override public void onFillable()