Issue #448 - RFC2616 Compliance Mode should track and report RFC7230 violations

Efficiency improvements
This commit is contained in:
Greg Wilkins 2016-03-24 11:37:39 +11:00
parent 4ae077f2b6
commit 8b228073e3
7 changed files with 11 additions and 16 deletions

View File

@ -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)

View File

@ -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;
}
/* ------------------------------------------------------------------------------- */

View File

@ -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()

View File

@ -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());

View File

@ -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);
}

View File

@ -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

View File

@ -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()