You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Ebert, Chris" <ch...@hp.com> on 2008/04/30 22:28:52 UTC
Bug in CommonsHTTPSender: cookies fail to send when using a virtual
host.
I'm using commons-httpclient 3.1 and found I couldn't send cookies. I have to set a virtual host: unavoidable for me, but the root of the problem.
A patch in CommonsHTTPClient solved the problem:
if (msgContext.getMaintainSession()) {
HttpState state = httpClient.getState();
method.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
+ final String host = hostConfiguration.getParams().getVirtualHost() == null ? hostConfiguration.getHost() : hostConfiguration.getParams().getVirtualHost();
String path = targetURL.getPath();
boolean secure = hostConfiguration.getProtocol().isSecure();
fillHeaders(msgContext, state, HTTPConstants.HEADER_COOKIE, host, path, secure);
fillHeaders(msgContext, state, HTTPConstants.HEADER_COOKIE2, host, path, secure);
httpClient.setState(state);
}
The line used to assume hostConfiguration.getHost() was always the right host to set. Httpclient checks against the name of the virtual host if one is set.
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org