Any parameter can be applied either at the method, host, or client level See <http://jakarta.apache.org/commons/httpclient/3.0/preference- api.html>
The trouble is that the CONNECT method seems to be taking its parameters from the client, ignoring those set at the method and host level Feel free to file a bug report and I'll provide a fix shortly Oleg On Sat, 2005-02-12 at 16:32 +0300, Riad Souissi wrote: > You said setVersion() should work on Proxy comm; where do you apply it ? > I may have miss-used it (I have this: > postmethod.getParams().setVersion(HttpVersion.HTTP_1_1). > However, it should be possible to specify a different HTTP version for > proxy comm from the tunnled comm (it may be the case already, but I do > not see how). > > Here are the logs: > > > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] DefaultHttpParams - Set > parameter http.protocol.version = HTTP/1.0 > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] DefaultHttpParams - Set > parameter http.method.retry-handler = > [EMAIL PROTECTED] > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] DefaultHttpParams - Set > parameter http.protocol.cookie-policy = ignoreCookies > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] > MultiThreadedHttpConnectionManager - > HttpConnectionManager.getConnection: config = > HostConfiguration[host=https://devwebm.xxxx.com, > proxyHost=http://proxy.yyyy.com:8080], timeout = 30000 > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] > MultiThreadedHttpConnectionManager - Getting free connection, > hostConfig=HostConfiguration[host=https://devwebm.xxxx.com, > proxyHost=http://proxy.yyyy.com:8080] > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpMethodDirector - > Preemptively sending default basic credentials > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpMethodDirector - > Authenticating with BASIC <any realm>@proxy.yyyy.com:8080 > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpMethodParams - Credential > charset not configured, using HTTP element charset > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpMethodDirector - > Authenticating with BASIC <any realm>@devwebm.xxxx.com:443 > > > > > > > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpMethodParams - Credential > charset not configured, using HTTP element charset > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpConnection - Open > connection to proxy.yyyy.com:8080 > > > > > > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] header - >> "CONNECT > devwebm.xxxx.com:443 HTTP/1.1" > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] HttpMethodBase - Adding Host > request header > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] header - >> "User-Agent: > Jakarta Commons-HttpClient/3.0-rc1[\r][\n]" > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] header - >> "Host: > devwebm.xxxx.com[\r][\n]" > 2005/02/12 15:07:21:234 GMT+03:00 [DEBUG] header - >> "Proxy-Connection: > Keep-Alive[\r][\n]" > 2005/02/12 15:07:21:266 GMT+03:00 [DEBUG] header - >> "[\r][\n]" > 2005/02/12 15:07:22:000 GMT+03:00 [DEBUG] header - << "HTTP/1.0 200 > Connection established[\r][\n]" > 2005/02/12 15:07:22:000 GMT+03:00 [DEBUG] header - << "Proxy-agent: > BlueCoat-Security-Appliance[\r][\n]" > 2005/02/12 15:07:22:000 GMT+03:00 [DEBUG] ConnectMethod - CONNECT status > code 200 > 2005/02/12 15:07:22:016 GMT+03:00 [DEBUG] HttpConnection - Secure tunnel > to devwebm.xxxx.com:443 > 2005/02/12 15:07:22:016 GMT+03:00 [DEBUG] HttpMethodDirector - Closing > the connection. > 2005/02/12 15:07:22:016 GMT+03:00 [DEBUG] HttpConnection - Releasing > connection back to connection manager. > 2005/02/12 15:07:22:016 GMT+03:00 [DEBUG] > MultiThreadedHttpConnectionManager - Freeing connection, > hostConfig=HostConfiguration[host=https://devwebm.xxxx.com, > proxyHost=http://proxy.yyyy.com:8080] > 2005/02/12 15:07:22:016 GMT+03:00 [DEBUG] IdleConnectionHandler - Adding > connection at: 1108210042016 > 2005/02/12 15:07:22:016 GMT+03:00 [DEBUG] > MultiThreadedHttpConnectionManager - Notifying no-one, there are no > waiting threads > java.net.SocketException: Socket closed > at java.net.PlainSocketImpl.socketGetOption(Native Method) > at > java.net.PlainSocketImpl.getOption(PlainSocketImpl.java(Compiled Code)) > at java.net.Socket.getSendBufferSize(Socket.java:548) > at > org.apache.commons.httpclient.HttpConnection.tunnelCreated(HttpConnectio > n.java:792) > at > org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpCon > nectionAdapter.tunnelCreated(MultiThreadedHttpConnectionManager.java:149 > 9) > at > org.apache.commons.httpclient.HttpMethodDirector.executeConnect(HttpMeth > odDirector.java:488) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe > thodDirector.java:363) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho > dDirector.java:168) > > Thanks in advance, > riad > > -----Original Message----- > From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] > Sent: Saturday, February 12, 2005 4:15 PM > To: [email protected] > Subject: Re: Problems using the HTTPClient through a proxy > > On Sat, 2005-02-12 at 15:35 +0300, Riad Souissi wrote: > > Hi all, > > > > I am using HTTPClient 3.0-rc1. > > I am connecting to an HTTPS site through a proxy. > > > > 1) I used HTTPLook to see the HTTP messages between the Proxy and the > > HTTPClient. > > I noticed that it always used HTTP/1.1 and I could not find how to get > > > the HTTPClient to use HTTP/1.0 with the proxy instead. > > The setVersion() method, when used, only impacts the tunneled HTTP > > protocol between the HTTPClient and the target host. > > Riad, > setVersion() should also work for proxy communication. Please post the > wire/context log of the HTTP session. See > <http://jakarta.apache.org/commons/httpclient/3.0/logging.html> for > details. I'll take a look at the log > > > > > => Do you know how I can force the client to use HTTP/1.0 with the > > proxy ? > > > > 2) I also that the HTTPClient does not specify the Content-Length in > > the HTTP header with the Proxy. > > This seems to cause the Proxy to reject the connection from the > > HTTPClient. > > It should not. The Content-Length (or Transfer-Encoding) is required for > entity enclosing methods. HTTP CONNECT is not supposed to enclose an > entity > > > > > > When I use the Internet Explorer, I can see that Content-Length is > > specified (value is 0). > > > > Well, after all, it is IE. > > Oleg > > > => Do you know how I can force the client to specify this header with > > the proxy ? > > > > Thanks in advance, > > riad > > > > DiscalimerThe information in this email and in any files transmitted with it, > is intended only for the addressee and may contain confidential and/or > privileged material. > Access to this email by anyone else is unauthorized. If you receive this in > error, > please contact the sender immediately and delete the material from any > computer. > If you are not the intended recipient, any disclosure, copying, distribution > or > any action taken or omitted to be taken in reliance on it, is strictly > prohibited. > Statement and opinions expressed in this e-mail are those of the sender, and > do not > necessarily reflect those of STC. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
