Author: olegk
Date: Wed May 11 12:13:29 2005
New Revision: 169676

URL: http://svn.apache.org/viewcvs?rev=169676&view=rev
Log:
PR #34740 (Connection with the proxy is not reopened if an proxy auth failure 
occurs while SSL tunnel is being established)
PR #34799 (Httpclient fails to set up tunnel with an HTTP 1.0 proxy server 
without keep alive)

Contributed by Oleg Kalnichevski

Modified:
    
jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
    
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestProxy.java

Modified: 
jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpMethodDirector.java?rev=169676&r1=169675&r2=169676&view=diff
==============================================================================
--- 
jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
 (original)
+++ 
jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpMethodDirector.java
 Wed May 11 12:13:29 2005
@@ -473,6 +473,9 @@
         
         int code;
         for (;;) {
+            if (!this.conn.isOpen()) {
+                this.conn.open();
+            }
             try {
                 authenticateProxy(this.connectMethod);
             } catch (AuthenticationException e) {

Modified: 
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestProxy.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestProxy.java?rev=169676&r1=169675&r2=169676&view=diff
==============================================================================
--- 
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestProxy.java
 (original)
+++ 
jakarta/commons/proper/httpclient/trunk/src/test/org/apache/commons/httpclient/TestProxy.java
 Wed May 11 12:13:29 2005
@@ -771,5 +771,34 @@
             get.releaseConnection();
         }
     }
+
+    /**
+     * Tests GET via authenticating proxy + host auth + HTTP/1.0 
+     */
+    public void testGetProxyAuthHostAuthHTTP10() throws Exception {
+
+        UsernamePasswordCredentials creds = 
+            new UsernamePasswordCredentials("testuser", "testpass");
         
+        this.client.getState().setCredentials(AuthScope.ANY, creds);
+        this.client.getState().setProxyCredentials(AuthScope.ANY, creds);
+        this.client.getParams().setVersion(HttpVersion.HTTP_1_0);
+        
+        HttpRequestHandlerChain handlerchain = new HttpRequestHandlerChain();
+        handlerchain.appendHandler(new AuthRequestHandler(creds, "test", 
true));
+        handlerchain.appendHandler(new HttpServiceHandler(new 
FeedbackService()));
+        
+        this.server.setRequestHandler(handlerchain);
+        
+        this.proxy.requireAuthentication(creds, "test", false);
+        
+        GetMethod get = new GetMethod("/");
+        try {
+            this.client.executeMethod(get);
+            assertEquals(HttpStatus.SC_OK, get.getStatusCode());
+        } finally {
+            get.releaseConnection();
+        }
+    }
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to