On Sun, 2011-06-19 at 21:32 +0200, Bart Robeyns wrote: > There's an example of how to tunnel with 4.1, somewhat hidden away at > http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/conn/ManagerConnectProxy.java. > At lines 106-107 a CONNECT-request is build and a header is added to it. > > HttpRequest connect = new BasicHttpRequest("CONNECT", authority, > HttpVersion.HTTP_1_1); > connect.addHeader("Host", authority); > > I believe this allows you to add your own headers to the connect method. > > Note that 4.x is quite different from 3.x; the set of ...Method-classes no > longer exist, and has been replaced by HttpGet, HttpPost, ... The 3.x > ConnectMethod has no counterpart in 4.x - but you can easily build it > yourself as the example shows. >
With 4.x API the easiest way to add a header or a set of headers to all outgoing requests is by using a cuastom protocol interceptor http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#protocol_interceptors Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
