hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r780802 - in /httpcomponents/httpclient/trunk: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
Date Mon, 01 Jun 2009 20:01:01 GMT
Author: olegk
Date: Mon Jun  1 20:01:01 2009
New Revision: 780802

URL: http://svn.apache.org/viewvc?rev=780802&view=rev
Log:
HTTPCLIENT-853: Fixed bug causing invalid cookie origin port to be selected when the target
is accessed on the default port and the connection is established via a proxy

Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=780802&r1=780801&r2=780802&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Mon Jun  1 20:01:01 2009
@@ -1,6 +1,11 @@
 Changes since 4.0 beta 2
 -------------------
 
+* [HTTPCLIENT-853] Fixed bug causing invalid cookie origin port to be selected 
+  when the target is accessed on the default port and the connection is 
+  established via a proxy.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-852] Fixed bug causing automatically retried redirects fail with 
   CircularRedirectException.  
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java?rev=780802&r1=780801&r2=780802&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/protocol/RequestAddCookies.java
Mon Jun  1 20:01:01 2009
@@ -51,6 +51,8 @@
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.client.params.HttpClientParams;
 import org.apache.http.conn.ManagedClientConnection;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.cookie.Cookie;
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.CookieSpec;
@@ -147,7 +149,16 @@
         String hostName = targetHost.getHostName();
         int port = targetHost.getPort();
         if (port < 0) {
-            port = conn.getRemotePort();
+
+            // Obtain the scheme registry
+            SchemeRegistry sr = (SchemeRegistry) context.getAttribute(
+                    ClientContext.AUTHSCHEME_REGISTRY);
+            if (sr != null) {
+                Scheme scheme = sr.get(targetHost.getSchemeName());
+                port = scheme.resolvePort(port);
+            } else {
+                port = conn.getRemotePort();
+            }
         }
         
         CookieOrigin cookieOrigin = new CookieOrigin(



Mime
View raw message