Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x
This commit is contained in:
commit
75677b8a61
|
@ -496,6 +496,14 @@ public class Request implements HttpServletRequest
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isContentEncodingSupported()
|
||||
{
|
||||
String contentEncoding = getHttpFields().get(HttpHeader.CONTENT_ENCODING);
|
||||
if (contentEncoding == null)
|
||||
return true;
|
||||
return HttpHeaderValue.IDENTITY.is(contentEncoding);
|
||||
}
|
||||
|
||||
private void extractContentParameters()
|
||||
{
|
||||
String contentType = getContentType();
|
||||
|
@ -511,12 +519,11 @@ public class Request implements HttpServletRequest
|
|||
if (MimeTypes.Type.FORM_ENCODED.is(baseType) &&
|
||||
_channel.getHttpConfiguration().isFormEncodedMethod(getMethod()))
|
||||
{
|
||||
if (_metaData != null)
|
||||
if (_metaData != null && !isContentEncodingSupported())
|
||||
{
|
||||
String contentEncoding = getHttpFields().get(HttpHeader.CONTENT_ENCODING);
|
||||
if (contentEncoding != null && !HttpHeaderValue.IDENTITY.is(contentEncoding))
|
||||
throw new BadMessageException(HttpStatus.NOT_IMPLEMENTED_501, "Unsupported Content-Encoding");
|
||||
throw new BadMessageException(HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, "Unsupported Content-Encoding");
|
||||
}
|
||||
|
||||
extractFormParameters(_contentParameters);
|
||||
}
|
||||
else if (MimeTypes.Type.MULTIPART_FORM_DATA.is(baseType) &&
|
||||
|
@ -525,8 +532,10 @@ public class Request implements HttpServletRequest
|
|||
{
|
||||
try
|
||||
{
|
||||
if (_metaData != null && getHttpFields().contains(HttpHeader.CONTENT_ENCODING))
|
||||
throw new BadMessageException(HttpStatus.NOT_IMPLEMENTED_501, "Unsupported Content-Encoding");
|
||||
if (_metaData != null && !isContentEncodingSupported())
|
||||
{
|
||||
throw new BadMessageException(HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, "Unsupported Content-Encoding");
|
||||
}
|
||||
getParts(_contentParameters);
|
||||
}
|
||||
catch (IOException e)
|
||||
|
|
|
@ -572,7 +572,7 @@ public class RequestTest
|
|||
}
|
||||
catch (BadMessageException e)
|
||||
{
|
||||
return e.getCode() == 501;
|
||||
return e.getCode() == 415;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue