Minor changes after review by gregw.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
b3d5333d42
commit
1eec234336
|
@ -49,7 +49,7 @@ import org.eclipse.jetty.util.log.Logger;
|
||||||
* be altered in code and will affect all usages of the mode.
|
* be altered in code and will affect all usages of the mode.
|
||||||
*/
|
*/
|
||||||
public enum HttpCompliance // TODO in Jetty-10 convert this enum to a class so that extra custom modes can be defined dynamically
|
public enum HttpCompliance // TODO in Jetty-10 convert this enum to a class so that extra custom modes can be defined dynamically
|
||||||
{
|
{
|
||||||
/** A Legacy compliance mode to match jetty's behavior prior to RFC2616 and RFC7230. It only
|
/** A Legacy compliance mode to match jetty's behavior prior to RFC2616 and RFC7230. It only
|
||||||
* contains {@link HttpComplianceSection#METHOD_CASE_SENSITIVE}
|
* contains {@link HttpComplianceSection#METHOD_CASE_SENSITIVE}
|
||||||
*/
|
*/
|
||||||
|
@ -82,6 +82,8 @@ public enum HttpCompliance // TODO in Jetty-10 convert this enum to a class so t
|
||||||
@Deprecated
|
@Deprecated
|
||||||
CUSTOM3(sectionsByProperty("CUSTOM3"));
|
CUSTOM3(sectionsByProperty("CUSTOM3"));
|
||||||
|
|
||||||
|
public static final String VIOLATIONS_ATTR = "org.eclipse.jetty.http.compliance.violations";
|
||||||
|
|
||||||
private static final Logger LOG = Log.getLogger(HttpParser.class);
|
private static final Logger LOG = Log.getLogger(HttpParser.class);
|
||||||
private static EnumSet<HttpComplianceSection> sectionsByProperty(String property)
|
private static EnumSet<HttpComplianceSection> sectionsByProperty(String property)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,8 +51,6 @@ public class HttpChannelOverHttp extends HttpChannel implements HttpParser.Reque
|
||||||
{
|
{
|
||||||
private static final Logger LOG = Log.getLogger(HttpChannelOverHttp.class);
|
private static final Logger LOG = Log.getLogger(HttpChannelOverHttp.class);
|
||||||
private final static HttpField PREAMBLE_UPGRADE_H2C = new HttpField(HttpHeader.UPGRADE, "h2c");
|
private final static HttpField PREAMBLE_UPGRADE_H2C = new HttpField(HttpHeader.UPGRADE, "h2c");
|
||||||
public static final String ATTR_COMPLIANCE_VIOLATIONS = "org.eclipse.jetty.http.compliance.violations";
|
|
||||||
|
|
||||||
private final HttpFields _fields = new HttpFields();
|
private final HttpFields _fields = new HttpFields();
|
||||||
private final MetaData.Request _metadata = new MetaData.Request(_fields);
|
private final MetaData.Request _metadata = new MetaData.Request(_fields);
|
||||||
private final HttpConnection _httpConnection;
|
private final HttpConnection _httpConnection;
|
||||||
|
@ -291,7 +289,7 @@ public class HttpChannelOverHttp extends HttpChannel implements HttpParser.Reque
|
||||||
{
|
{
|
||||||
if (_complianceViolations != null && !_complianceViolations.isEmpty())
|
if (_complianceViolations != null && !_complianceViolations.isEmpty())
|
||||||
{
|
{
|
||||||
this.getRequest().setAttribute(ATTR_COMPLIANCE_VIOLATIONS, _complianceViolations);
|
this.getRequest().setAttribute(HttpCompliance.VIOLATIONS_ATTR, _complianceViolations);
|
||||||
_complianceViolations=null;
|
_complianceViolations=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class MultiPartCleanerListener implements ServletRequestListener
|
||||||
{
|
{
|
||||||
parts.close();
|
parts.close();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
sre.getServletContext().log("Errors deleting multipart tmp files", e);
|
sre.getServletContext().log("Errors deleting multipart tmp files", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ import javax.servlet.http.Part;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.BadMessageException;
|
import org.eclipse.jetty.http.BadMessageException;
|
||||||
import org.eclipse.jetty.http.HostPortHttpField;
|
import org.eclipse.jetty.http.HostPortHttpField;
|
||||||
|
import org.eclipse.jetty.http.HttpCompliance;
|
||||||
import org.eclipse.jetty.http.HttpCookie;
|
import org.eclipse.jetty.http.HttpCookie;
|
||||||
import org.eclipse.jetty.http.HttpField;
|
import org.eclipse.jetty.http.HttpField;
|
||||||
import org.eclipse.jetty.http.HttpFields;
|
import org.eclipse.jetty.http.HttpFields;
|
||||||
|
@ -2605,11 +2606,11 @@ public class Request implements HttpServletRequest
|
||||||
if (!nonComplianceWarnings.isEmpty())
|
if (!nonComplianceWarnings.isEmpty())
|
||||||
{
|
{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> violations = (List<String>)getAttribute(HttpChannelOverHttp.ATTR_COMPLIANCE_VIOLATIONS);
|
List<String> violations = (List<String>)getAttribute(HttpCompliance.VIOLATIONS_ATTR);
|
||||||
if (violations==null)
|
if (violations==null)
|
||||||
{
|
{
|
||||||
violations = new ArrayList<>();
|
violations = new ArrayList<>();
|
||||||
setAttribute(HttpChannelOverHttp.ATTR_COMPLIANCE_VIOLATIONS,violations);
|
setAttribute(HttpCompliance.VIOLATIONS_ATTR,violations);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(NonCompliance nc : nonComplianceWarnings)
|
for(NonCompliance nc : nonComplianceWarnings)
|
||||||
|
|
|
@ -59,6 +59,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.Part;
|
import javax.servlet.http.Part;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.BadMessageException;
|
import org.eclipse.jetty.http.BadMessageException;
|
||||||
|
import org.eclipse.jetty.http.HttpCompliance;
|
||||||
import org.eclipse.jetty.http.HttpTester;
|
import org.eclipse.jetty.http.HttpTester;
|
||||||
import org.eclipse.jetty.http.MimeTypes;
|
import org.eclipse.jetty.http.MimeTypes;
|
||||||
import org.eclipse.jetty.server.LocalConnector.LocalEndPoint;
|
import org.eclipse.jetty.server.LocalConnector.LocalEndPoint;
|
||||||
|
@ -1818,7 +1819,7 @@ public class RequestTest
|
||||||
assertNotNull(foo);
|
assertNotNull(foo);
|
||||||
assertTrue(foo.getSize() > 0);
|
assertTrue(foo.getSize() > 0);
|
||||||
response.setStatus(200);
|
response.setStatus(200);
|
||||||
List<String> violations = (List<String>)request.getAttribute(HttpChannelOverHttp.ATTR_COMPLIANCE_VIOLATIONS);
|
List<String> violations = (List<String>)request.getAttribute(HttpCompliance.VIOLATIONS_ATTR);
|
||||||
if(violations != null)
|
if(violations != null)
|
||||||
{
|
{
|
||||||
for(String v : violations)
|
for(String v : violations)
|
||||||
|
|
Loading…
Reference in New Issue