hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1084694 - in /httpcomponents/httpclient/branches/4.1.x/httpclient-cache: ./ src/main/java/org/apache/http/client/cache/ src/main/java/org/apache/http/impl/client/cache/ src/test/java/org/apache/http/impl/client/cache/
Date Wed, 23 Mar 2011 19:46:08 GMT
Author: jonm
Date: Wed Mar 23 19:46:08 2011
New Revision: 1084694

URL: http://svn.apache.org/viewvc?rev=1084694&view=rev
Log:
HTTPCLIENT-1073: caching module need not be a stickler about receiving
a 407 (Proxy Authentication Required) response without a Proxy-Authenticate
header and should pass it through to local client. (backport of r1084590
from trunk)


Modified:
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/   (props changed)
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheStorage.java
  (props changed)
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java
  (props changed)
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java

Propchange: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 23 19:46:08 2011
@@ -1,4 +1,4 @@
 /httpcomponents/httpclient/branches/4.0.x/httpclient-cache:950681-950688
 /httpcomponents/httpclient/branches/branch_4_1/httpclient-cache:755593-811107
 /httpcomponents/httpclient/branches/notice-plugin-test/httpclient-cache:1024348-1031454
-/httpcomponents/httpclient/trunk/httpclient-cache:1080419,1080422,1080575
+/httpcomponents/httpclient/trunk/httpclient-cache:1080419,1080422,1080575,1084590

Propchange: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheStorage.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 23 19:46:08 2011
@@ -1,3 +1,3 @@
 /httpcomponents/httpclient/branches/4.0.x/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java:950681-950688
 /httpcomponents/httpclient/branches/branch_4_1/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCache.java:755593-811107
-/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheStorage.java:1080419,1080422,1080575
+/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/HttpCacheStorage.java:1080419,1080422,1080575,1084590

Propchange: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 23 19:46:08 2011
@@ -1,3 +1,3 @@
 /httpcomponents/httpclient/branches/4.0.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java:950681-950688
 /httpcomponents/httpclient/branches/branch_4_1/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCache.java:755593-811107
-/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java:1080419,1080422,1080575
+/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/BasicHttpCacheStorage.java:1080419,1080422,1080575,1084590

Modified: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java?rev=1084694&r1=1084693&r2=1084694&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
(original)
+++ httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
Wed Mar 23 19:46:08 2011
@@ -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)

Modified: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java?rev=1084694&r1=1084693&r2=1084694&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
(original)
+++ httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestProtocolDeviations.java
Wed Mar 23 19:46:08 2011
@@ -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



Mime
View raw message