Always use remote port of the underyling connection as default when creating CookieOrigin instance

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1055406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-01-05 10:54:20 +00:00
parent 232ee999c8
commit e95f6ce960
1 changed files with 1 additions and 12 deletions

View File

@ -48,8 +48,6 @@ import org.apache.http.client.CookieStore;
import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.params.HttpClientParams; import org.apache.http.client.params.HttpClientParams;
import org.apache.http.conn.ManagedClientConnection; 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.Cookie;
import org.apache.http.cookie.CookieOrigin; import org.apache.http.cookie.CookieOrigin;
import org.apache.http.cookie.CookieSpec; import org.apache.http.cookie.CookieSpec;
@ -146,17 +144,8 @@ public class RequestAddCookies implements HttpRequestInterceptor {
String hostName = targetHost.getHostName(); String hostName = targetHost.getHostName();
int port = targetHost.getPort(); int port = targetHost.getPort();
if (port < 0) { if (port < 0) {
// Obtain the scheme registry
SchemeRegistry sr = (SchemeRegistry) context.getAttribute(
ClientContext.SCHEME_REGISTRY);
if (sr != null) {
Scheme scheme = sr.get(targetHost.getSchemeName());
port = scheme.resolvePort(port);
} else {
port = conn.getRemotePort(); port = conn.getRemotePort();
} }
}
CookieOrigin cookieOrigin = new CookieOrigin( CookieOrigin cookieOrigin = new CookieOrigin(
hostName, hostName,