480162 - Continuations behavior differences due to HttpURI behavior

Cleaned up handling of original URI
This commit is contained in:
Greg Wilkins 2015-10-28 17:33:05 +11:00
parent 4ffe0d375e
commit 36de309e9f
5 changed files with 19 additions and 6 deletions

View File

@ -119,6 +119,7 @@ public class HttpURI
public HttpURI(HttpURI uri) public HttpURI(HttpURI uri)
{ {
this(uri._scheme,uri._host,uri._port,uri._path,uri._param,uri._query,uri._fragment); this(uri._scheme,uri._host,uri._port,uri._path,uri._param,uri._query,uri._fragment);
_uri=uri._uri;
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -158,7 +158,6 @@ public class MetaData implements Iterable<HttpField>
this(request.getMethod(),new HttpURI(request.getURI()), request.getVersion(), new HttpFields(request.getFields()), request.getContentLength()); this(request.getMethod(),new HttpURI(request.getURI()), request.getVersion(), new HttpFields(request.getFields()), request.getContentLength());
} }
// TODO MetaData should be immuttable!!!
public void recycle() public void recycle()
{ {
super.recycle(); super.recycle();

View File

@ -142,7 +142,7 @@ public abstract class AbstractNCSARequestLog extends AbstractLifeCycle implement
buf.append("] \""); buf.append("] \"");
append(buf,request.getMethod()); append(buf,request.getMethod());
buf.append(' '); buf.append(' ');
append(buf,request.getHttpURI().toString()); append(buf,request.getOriginalURI());
buf.append(' '); buf.append(' ');
append(buf,request.getProtocol()); append(buf,request.getProtocol());
buf.append("\" "); buf.append("\" ");

View File

@ -161,6 +161,7 @@ public class Request implements HttpServletRequest
private final HttpInput _input; private final HttpInput _input;
private MetaData.Request _metadata; private MetaData.Request _metadata;
private String _originalURI;
private String _contextPath; private String _contextPath;
private String _servletPath; private String _servletPath;
@ -1578,6 +1579,14 @@ public class Request implements HttpServletRequest
return _metadata==null?null:_metadata.getURI(); return _metadata==null?null:_metadata.getURI();
} }
/* ------------------------------------------------------------ */
/**
* @return Returns the original uri passed in metadata before customization/rewrite
*/
public String getOriginalURI()
{
return _originalURI;
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* @param uri the URI to set * @param uri the URI to set
@ -1747,6 +1756,7 @@ public class Request implements HttpServletRequest
public void setMetaData(org.eclipse.jetty.http.MetaData.Request request) public void setMetaData(org.eclipse.jetty.http.MetaData.Request request)
{ {
_metadata=request; _metadata=request;
_originalURI=_metadata.getURIString();
setMethod(request.getMethod()); setMethod(request.getMethod());
HttpURI uri = request.getURI(); HttpURI uri = request.getURI();
@ -1803,6 +1813,7 @@ public class Request implements HttpServletRequest
protected void recycle() protected void recycle()
{ {
_metadata=null; _metadata=null;
_originalURI=null;
if (_context != null) if (_context != null)
throw new IllegalStateException("Request in context!"); throw new IllegalStateException("Request in context!");

View File

@ -72,7 +72,13 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer
SslConnection sslConnection = ssl_endp.getSslConnection(); SslConnection sslConnection = ssl_endp.getSslConnection();
SSLEngine sslEngine=sslConnection.getSSLEngine(); SSLEngine sslEngine=sslConnection.getSSLEngine();
customize(sslEngine,request); customize(sslEngine,request);
if (request.getHttpURI().getScheme()==null)
request.setScheme(HttpScheme.HTTPS.asString());
} }
if (HttpScheme.HTTPS.is(request.getScheme()))
request.setSecure(true);
} }
/** /**
@ -99,10 +105,6 @@ public class SecureRequestCustomizer implements HttpConfiguration.Customizer
*/ */
public void customize(SSLEngine sslEngine, Request request) public void customize(SSLEngine sslEngine, Request request)
{ {
request.setSecure(true);
if (request.getHttpURI().getScheme()==null)
request.getHttpURI().setScheme(HttpScheme.HTTPS.asString());
SSLSession sslSession = sslEngine.getSession(); SSLSession sslSession = sslEngine.getSession();
if (_sniHostCheck) if (_sniHostCheck)