diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java index d5de714d9..8c72fbdfd 100644 --- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java +++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java @@ -68,8 +68,6 @@ class ResponseProtocolCompliance { response.setEntity(null); } - authenticationRequiredDidNotHaveAProxyAuthenticationHeader(request, response); - notAllowedResponseDidNotHaveAnAllowHeader(request, response); unauthorizedResponseDidNotHaveAWWWAuthenticateHeader(request, response); @@ -150,16 +148,6 @@ class ResponseProtocolCompliance { } } - private void authenticationRequiredDidNotHaveAProxyAuthenticationHeader(HttpRequest request, - HttpResponse response) throws ClientProtocolException { - if (response.getStatusLine().getStatusCode() != HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) - return; - - if (response.getFirstHeader(HeaderConstants.PROXY_AUTHENTICATE) == null) - throw new ClientProtocolException( - "407 Response did not contain a Proxy-Authentication header"); - } - private void notAllowedResponseDidNotHaveAnAllowHeader(HttpRequest request, HttpResponse response) throws ClientProtocolException { if (response.getStatusLine().getStatusCode() != HttpStatus.SC_METHOD_NOT_ALLOWED) diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java index 9a3842c6c..a41c8894b 100644 --- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java +++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java @@ -362,7 +362,7 @@ public class TestProtocolDeviations { * http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.8 */ @Test - public void testCantReturnA407WithoutAProxyAuthenticateHeader() throws Exception { + public void testPassesOnOrigin407WithoutAProxyAuthenticateHeader() throws Exception { originResponse = new BasicHttpResponse(HTTP_1_1, 407, "Proxy Authentication Required"); org.easymock.EasyMock.expect( @@ -370,23 +370,9 @@ public class TestProtocolDeviations { org.easymock.EasyMock.isA(HttpRequest.class), (HttpContext) org.easymock.EasyMock.isNull())).andReturn(originResponse); replayMocks(); - - boolean gotException = false; - // this is another case where we are caught in a sticky - // situation, where the origin was not 1.1-compliant. - try { - HttpResponse result = impl.execute(host, request); - Assert.fail("should have gotten ClientProtocolException"); - - if (result.getStatusLine().getStatusCode() == 407) { - Assert.assertNotNull(result.getFirstHeader("Proxy-Authentication")); - } - } catch (ClientProtocolException possiblyAcceptableBehavior) { - gotException = true; - } - + HttpResponse result = impl.execute(host, request); verifyMocks(); - Assert.assertTrue(gotException); + Assert.assertSame(originResponse, result); } } \ No newline at end of file