Merged branch 'jetty-9.4.x' into 'master'.
This commit is contained in:
commit
3293df2f36
|
@ -216,7 +216,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
return false;
|
||||
|
||||
String method = exchange.getRequest().getMethod();
|
||||
parser.setHeadResponse(HttpMethod.HEAD.is(method) || HttpMethod.CONNECT.is(method));
|
||||
parser.setHeadResponse(HttpMethod.HEAD.is(method) ||
|
||||
(HttpMethod.CONNECT.is(method) && status == HttpStatus.OK_200));
|
||||
exchange.getResponse().version(version).status(status).reason(reason);
|
||||
|
||||
return !responseBegin(exchange);
|
||||
|
|
|
@ -481,6 +481,29 @@ public class ForwardProxyTLSServerTest
|
|||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProxyAuthenticationWithResponseContent() throws Exception
|
||||
{
|
||||
final String realm = "test-realm";
|
||||
testProxyAuthentication(realm, new ConnectHandler()
|
||||
{
|
||||
@Override
|
||||
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
String proxyAuth = request.getHeader(HttpHeader.PROXY_AUTHORIZATION.asString());
|
||||
if (proxyAuth == null)
|
||||
{
|
||||
baseRequest.setHandled(true);
|
||||
response.setStatus(HttpStatus.PROXY_AUTHENTICATION_REQUIRED_407);
|
||||
response.setHeader(HttpHeader.PROXY_AUTHENTICATE.asString(), "Basic realm=\"" + realm + "\"");
|
||||
response.getOutputStream().write(new byte[4096]);
|
||||
return;
|
||||
}
|
||||
super.handle(target, baseRequest, request, response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProxyAuthenticationClosesConnection() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue