Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD9339D18 for ; Thu, 22 Mar 2012 09:55:12 +0000 (UTC) Received: (qmail 92164 invoked by uid 500); 22 Mar 2012 09:55:12 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 91956 invoked by uid 500); 22 Mar 2012 09:55:07 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 91919 invoked by uid 99); 22 Mar 2012 09:55:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2012 09:55:05 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2012 09:54:59 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1SAej7-0004bK-W8 for httpclient-users@hc.apache.org; Thu, 22 Mar 2012 02:54:37 -0700 Message-ID: <33544606.post@talk.nabble.com> Date: Thu, 22 Mar 2012 02:54:37 -0700 (PDT) From: diyfiesta To: httpclient-users@hc.apache.org Subject: Re: Implementing Proxy Chaining in Apache HTTP In-Reply-To: <1332152579.504.4.camel@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: toby.weston@gmail.com References: <5B51A967-FCD8-475E-8DFB-A831B8E89350@gmail.com> <0CD00838-2734-440B-A5DD-13F5B42B63AD@gmail.com> <1332152579.504.4.camel@ubuntu> X-Virus-Checked: Checked by ClamAV on apache.org Great stuff... Something like this? DefaultHttpClient client = new DefaultHttpClient(connectionManager, httpParameters) { @Override protected RequestDirector createClientRequestDirector(HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectStrategy redirectStrategy, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler stateHandler, HttpParams params) { return new DefaultRequestDirector(LogFactory.getLog(AbstractHttpClient.class), requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectStrategy, targetAuthHandler, proxyAuthHandler, stateHandler, params) { @Override protected boolean createTunnelToProxy(HttpRoute route, int hop, HttpContext context) throws HttpException, IOException { // my stuff here! return super.createTunnelToProxy(route, hop, context); } }; } }; I just wanted to check because there may be a neater way to wire in my custom class that I didn't spot... Thanks olegk wrote: > > On Mon, 2012-03-19 at 07:00 +0000, Toby wrote: >> Hi folks, >> >> Alan, I'd certainly like to take a look at what you did. Did you use a >> similar approach or something completely different. >> >> Thanks Oleg too, i plan to sit down and have a go at implementing >> something. Do you suggest cloning the source and working directly with it >> or do you think I can extend it working with just the binaries? >> > > It might be possible just override > DefaultRequestDirector#createTunnelToProxy without having to make > modification to other parts of the class, but I guess it is going to be > easier to clone the project at github and hack up a working prototype > without constraints of backward compatibility as the first step. > > Oleg > >> Thanks again, >> Toby >> >> >> On 18 Mar 2012, at 19:17, Alan Ho wrote: >> >> > Hi Toby, >> > >> > I've implemented a statistics recorder that I'd be happy to share with >> you. We are planning to opensource the statistics recorder, but haven't >> got around to it. >> > >> > Let me know if you would want to look at the code or get a demo. (or if >> anyone wants to take a look) >> > >> > Regards, >> > Alan Ho >> > >> > On Mar 17, 2012, at 7:27 AM, 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 >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org >> For additional commands, e-mail: httpclient-users-help@hc.apache.org >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org > For additional commands, e-mail: httpclient-users-help@hc.apache.org > > > -- View this message in context: http://old.nabble.com/Implementing-Proxy-Chaining-in-Apache-HTTP-tp33522405p33544606.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org