Issue #346 HttpParser RFC2616 Compliance mode
Added HttpParser.Compliance field to HttpConnectionFactory
This commit is contained in:
parent
48c4e08b94
commit
55eb54799f
|
@ -111,12 +111,12 @@ public class SslBytesServerTest extends SslBytesTest
|
||||||
@Override
|
@Override
|
||||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||||
{
|
{
|
||||||
return configure(new HttpConnection(getHttpConfiguration(), connector, endPoint)
|
return configure(new HttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance())
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected HttpParser newHttpParser()
|
protected HttpParser newHttpParser(HttpParser.Compliance compliance)
|
||||||
{
|
{
|
||||||
return new HttpParser(newRequestHandler(), getHttpConfiguration().getRequestHeaderSize())
|
return new HttpParser(newRequestHandler(), getHttpConfiguration().getRequestHeaderSize(),compliance)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean parseNext(ByteBuffer buffer)
|
public boolean parseNext(ByteBuffer buffer)
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class HTTP2CServerTest extends AbstractServerTest
|
||||||
@Override
|
@Override
|
||||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||||
{
|
{
|
||||||
HttpConnection connection = new HttpConnection(getHttpConfiguration(), connector, endPoint)
|
HttpConnection connection = new HttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance())
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onFillable()
|
public void onFillable()
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
return last;
|
return last;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint)
|
public HttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpParser.Compliance compliance)
|
||||||
{
|
{
|
||||||
super(endPoint, connector.getExecutor());
|
super(endPoint, connector.getExecutor());
|
||||||
_config = config;
|
_config = config;
|
||||||
|
@ -99,7 +99,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
_generator = newHttpGenerator();
|
_generator = newHttpGenerator();
|
||||||
_channel = newHttpChannel();
|
_channel = newHttpChannel();
|
||||||
_input = _channel.getRequest().getHttpInput();
|
_input = _channel.getRequest().getHttpInput();
|
||||||
_parser = newHttpParser();
|
_parser = newHttpParser(compliance);
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("New HTTP Connection {}", this);
|
LOG.debug("New HTTP Connection {}", this);
|
||||||
}
|
}
|
||||||
|
@ -119,9 +119,9 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
return new HttpChannelOverHttp(this, _connector, _config, getEndPoint(), this);
|
return new HttpChannelOverHttp(this, _connector, _config, getEndPoint(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpParser newHttpParser()
|
protected HttpParser newHttpParser(HttpParser.Compliance compliance)
|
||||||
{
|
{
|
||||||
return new HttpParser(newRequestHandler(), getHttpConfiguration().getRequestHeaderSize());
|
return new HttpParser(newRequestHandler(), getHttpConfiguration().getRequestHeaderSize(), compliance);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpParser.RequestHandler newRequestHandler()
|
protected HttpParser.RequestHandler newRequestHandler()
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.server;
|
package org.eclipse.jetty.server;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.http.HttpParser;
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.io.Connection;
|
import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
|
@ -31,6 +32,7 @@ import org.eclipse.jetty.util.annotation.Name;
|
||||||
public class HttpConnectionFactory extends AbstractConnectionFactory implements HttpConfiguration.ConnectionFactory
|
public class HttpConnectionFactory extends AbstractConnectionFactory implements HttpConfiguration.ConnectionFactory
|
||||||
{
|
{
|
||||||
private final HttpConfiguration _config;
|
private final HttpConfiguration _config;
|
||||||
|
private HttpParser.Compliance _httpCompliance=HttpParser.Compliance.RFC7230;
|
||||||
|
|
||||||
public HttpConnectionFactory()
|
public HttpConnectionFactory()
|
||||||
{
|
{
|
||||||
|
@ -52,9 +54,24 @@ public class HttpConnectionFactory extends AbstractConnectionFactory implements
|
||||||
return _config;
|
return _config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HttpParser.Compliance getHttpCompliance()
|
||||||
|
{
|
||||||
|
return _httpCompliance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param httpCompliance String value of {@link HttpParser.Compliance}
|
||||||
|
*/
|
||||||
|
public void setHttpCompliance(HttpParser.Compliance httpCompliance)
|
||||||
|
{
|
||||||
|
_httpCompliance = httpCompliance;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||||
{
|
{
|
||||||
return configure(new HttpConnection(_config, connector, endPoint), connector, endPoint);
|
return configure(new HttpConnection(_config, connector, endPoint, _httpCompliance), connector, endPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.http.HttpParser;
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.io.Connection;
|
import org.eclipse.jetty.io.Connection;
|
||||||
import org.eclipse.jetty.io.EndPoint;
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
|
@ -54,7 +55,7 @@ public class ExtendedServerTest extends HttpServerTestBase
|
||||||
@Override
|
@Override
|
||||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||||
{
|
{
|
||||||
return configure(new ExtendedHttpConnection(getHttpConfiguration(), connector, endPoint), connector, endPoint);
|
return configure(new ExtendedHttpConnection(getHttpConfiguration(), connector, endPoint,getHttpCompliance()), connector, endPoint);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
|
@ -92,9 +93,9 @@ public class ExtendedServerTest extends HttpServerTestBase
|
||||||
|
|
||||||
private static class ExtendedHttpConnection extends HttpConnection
|
private static class ExtendedHttpConnection extends HttpConnection
|
||||||
{
|
{
|
||||||
public ExtendedHttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint)
|
public ExtendedHttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint, HttpParser.Compliance compliance)
|
||||||
{
|
{
|
||||||
super(config,connector,endPoint);
|
super(config,connector,endPoint,compliance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class SlowClientWithPipelinedRequestTest
|
||||||
@Override
|
@Override
|
||||||
public Connection newConnection(Connector connector, EndPoint endPoint)
|
public Connection newConnection(Connector connector, EndPoint endPoint)
|
||||||
{
|
{
|
||||||
return configure(new HttpConnection(new HttpConfiguration(),connector,endPoint)
|
return configure(new HttpConnection(getHttpConfiguration(),connector,endPoint,getHttpCompliance())
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onFillable()
|
public void onFillable()
|
||||||
|
|
Loading…
Reference in New Issue