hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Implementing Proxy Chaining in Apache HTTP
Date Sun, 18 Mar 2012 13:31:25 GMT
On Sat, 2012-03-17 at 12:27 +0000, Toby wrote:
> Hi Folks,
> I posted a question on Stack Overflow (at
> http://stackoverflow.com/questions/9698935/proxy-chaining-in-apache-http)
> and it was suggested I ask here so here goes...
> I'd like to send http messages through something that I can control (mainly
> so that I can record statistics and stash the request/response along with
> the headers for auditing etc). So far, I'm using LittleProxy as a proxy to
> do this but I'd like to be able to send the messages through say, a
> corporate proxy before sending it onto my proxy. Hence I was looking at
> proxy tunnelling with Apache HTTP.
> I've found the source that says "Proxy chains are not supported." along
> with a developer comment suggesting it can be done and where to start
> looking. I'm happy to get stuck into the source and attempt to do so but
> it'd be great if I can get a few pointers (especially around how to hook
> any 'customisation' in).
> oh, I'd be happy to be corrected if I am on the wrong track. I'm assuming
> 'proxy tunnelling' is what I've tried to describe above and so is the right
> avenue...
> I should say that I'm open to alternative ideas too, I had originally tried
> to redirect all messages to a socket that I control, record the message
> details then send on to the original port but I didn't get very far with
> that.
> Thanks for any pointers,
> Toby

Hi Toby

HTTP proxy chaining is exactly what you want. HttpClient 4.0 API was
designed to be fully proxy chaining capable. The HttpRoutePlanner
interface that represents a strategy for composing routes for HTTP
connections can return an array of intermediate hops to the target, or
in other words, a chain of proxies. However, at the moment HttpClient
can handle one proxy chains only. Support for complex proxy chains was
seen as an enterprise feature and none of us felt compelled enough to
develop it at our own free time. 

If you want to add proxy chaining support to HttpClient you should
carefully study DefaultRequestDirector#establishRoute method and look at
implementing #createTunnelToProxy method.

Hope this helps


To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org

View raw message