hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jani Mattsson <jani.matts...@hotelzon.com>
Subject RE: Having problems with HTTPS proxy tunneling
Date Thu, 27 Feb 2003 14:09:17 GMT
Revisiting my own posting, the problem seems to be that in 
HttpClient.executeMethod(HostConfiguration hostConfiguration, HttpMethod
method),
in case the connection is not already open, in case of a proxied secure
connection, the method is wrapped into a ConnectMethod:

                    method = new ConnectMethod(method);

This wrapper method is then executed. However, reference to 
the wrapper method will be lost as the executeMethod returns.
Thereafter the original wrapped method will always be executed
directly, which works fine as long as the connection is open.
If the connection is no longer open, the original wrapped
method does not know how to re-open it properly because
that functionality was in ConnectMethod to which there is no
longer any reference.

A quick workaround to this that seems to work is to add
"if (connection.isOpen()) connection.close();" just before
the "if (!connection.isOpen())". Can't right now come up with 
any suggestion for an easy fix that would be architecturally 
really good here.

I do not know if this is already a known problem, couldn't find
it with a quick look at the BugZilla, but on the other hand, it's
my first time using that tool so maybe I was just looking at the 
wrong place. But hope this helps!

Jani

-----Original Message-----
From: Jani Mattsson [mailto:jani.mattsson@hotelzon.com] 
Sent: 27. helmikuuta 2003 14:49
To: 'commons-httpclient-dev@jakarta.apache.org'
Subject: Having problems with HTTPS proxy tunneling


Hi!
 
I am using commons-httpclient in a setup where I'm making connections to a
secure HTTPS server over a proxy server. I use POST-requests, and the first
request always works fine (albeit a bit slow because of SSL handshaking or
something). Subsequent request work fine if I do them soon enough after the
first request, but if there's been a longer pause I seem to run into
trouble.
 
The cause of the trouble seems to be either the remote HTTPS server or my
local proxy server (do not know which) dropping the tunneling connection
that httpclient creates during the first request. The results of which seem
to
vary: sometimes HttpClient.executeMethod() throws a HttpRecoverableException

to me, sometimes a java.net.SocketException is thrown somewhere down in the
call (HttpMethodBase.writeRequestHeaders there somewhere along the line) and
HttpClient tries a retry on its own. I get around the first case by just
creating a new PostMethod instance and retrying the very same request with
it, works fine, but I'm stuck right now with the second case. It seem
HttpClient won't try tunneling another time but just sends a 
"POST https://remote.host.com/foo/bar <https://remote.host.com/foo/bar>
HTTP/1.1" request to I do not know whom (my proxy or the remote server?),
gets a "HTTP/1.0 200 OK" response and then nothing more.
 
I do not know if the problem is with HttpClient or with either uncompliant
proxy or remote server.
 
Is there any way to turn any tunneling off altogether to see if the first
request would succeed in non-tunneling proxy mode? (I do not know the
details of the HTTPS proxying protocol, but I suppose the tunneling is
optional?!)
 
Any other ideas/hints about this?
 
All help is highly appreciated.
 
Best regards,
 
Jani Mattsson
 

Mime
View raw message