Issue #5448 - cleanup request.isSecure logic (#5450)

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-10-16 03:53:47 -05:00 committed by GitHub
parent 681f46bd2a
commit 34d27e8548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -38,7 +38,6 @@ import org.eclipse.jetty.http.BadMessageException;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpGenerator;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MetaData;
@ -694,8 +693,6 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
_request.setMetaData(request);
_request.setSecure(HttpScheme.HTTPS.is(request.getURI().getScheme()));
_combinedListener.onRequestBegin(_request);
if (LOG.isDebugEnabled())

View File

@ -1688,21 +1688,18 @@ public class Request implements HttpServletRequest
final HttpURI uri = request.getURI();
if (uri.isAbsolute() && uri.hasAuthority() && uri.getPath() != null)
{
_uri = uri;
}
else
{
HttpURI.Mutable builder = HttpURI.build(uri);
if (uri.isAbsolute())
{
if (uri.getPath() == null)
builder.path("/");
setSecure(HttpScheme.HTTPS.is(uri.getScheme()));
}
else
{
if (!uri.isAbsolute())
builder.scheme(HttpScheme.HTTP.asString());
}
if (uri.getPath() == null)
builder.path("/");
if (!uri.hasAuthority())
{
@ -1720,6 +1717,8 @@ public class Request implements HttpServletRequest
_uri = builder.asImmutable();
}
setSecure(HttpScheme.HTTPS.is(_uri.getScheme()));
String encoded = _uri.getPath();
String path;
if (encoded == null)