Thank you, Bart. I am using httpclient 3.0. I ran debugger to trace into HttpMethodDirector class. The proxy tunnel is created in executeConnect() method. At the beginning of the method (line 475 in HttpMethodDirector.java), an instance of ConnectMethod class is created to build the tunnel. The headers of get method to the target host are not copied to the instance of ConnectMethod. So during the creationg of the tunnel, the proxy cannot see the request headers. After the tunnel is set up, the headers of get method to the target host is sent to the proxy as general data.
The header I need to pass to the proxy is used to create the tunnel. From the source code, it seems 3.0 does not have such a capability. There are lots of changes in 4.0. Do you know httpclient4.x has this capability to pass a header to proxy to create the tunnel? Thanks, Bo Bart Robeyns wrote: > > The proxy also sees all request-headers, in the same manner the target > host > would; there's no "proxy-specific header"-type in HTTP. > Simply add your specific header it in the same way you would add a normal > request header, and the proxy will pick it up. > > > On Sat, Jun 18, 2011 at 7:49 AM, Wangbo126 <[email protected]> wrote: > >> >> Hello, >> >> I am trying to use httpclient 3.x or 4.x to communicate to a target host >> through a proxy. The proxy requires a specific header to establish the >> tunnel. How could I pass the required header to the proxy through >> httpclient? I know we can set headers to post/get method to the target >> host. >> But I am not sure we can set headers for proxy. I went through the >> internet >> and cannot find any document on this. >> >> Thank you very much for any suggestion. >> Bo >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/How-to-set-cutomized-header-for-httpclient-proxy--tp31873710p31873710.html >> Sent from the HttpClient-User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > -- View this message in context: http://old.nabble.com/How-to-set-cutomized-header-for-httpclient-proxy--tp31873710p31878362.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
