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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]