hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: Problem with https over proxy
Date Fri, 04 Jun 2004 13:21:54 GMT
Dave,
I believe you may be much better off implementing a custom connection manager and still letting
HttpClient take care of HTTP authentication, HTTPS tunneling and other stuff. 

Anyways, the sample below demonstrates how HTTPS tunneling can be implemented using just plain
HttpConnection

http://cvs.apache.org/viewcvs.cgi/jakarta-commons/httpclient/src/examples/Attic/CustomHttpConnection.java?rev=1.3.2.1&only_with_tag=HTTPCLIENT_2_0_BRANCH&view=markup

Oleg

-----Original Message-----
From:	Dave Seidel [mailto:dave@mindreef.com]
Sent:	Fri 6/4/2004 15:07
To:	'Commons HttpClient Project'; olegk@apache.org
Cc:	
Subject:	RE: Problem with https over proxy
Thanks, Oleg.  I will look into doing it that way, but I'm not sure if that
technique will be flexible enough for us.  My application is atypical and
somewhat specialized, because we're using HttpClient to invoke SOAP
requests, and need a lot of low-level control.  We handle proxies and
authentication, and we need to log everything (headers and bodies), which
has made it necessary to subclass both GetMethod and PostMethod.  Looks like
I may have to subclass ConnectMethod as well.  (We also use HttpClient to
subclass HttpURLConnection.)

- Dave

-----Original Message-----
From: Oleg Kalnichevski [mailto:olegk@apache.org] 
Sent: Thursday, June 03, 2004 5:54 PM
To: Commons HttpClient Project
Subject: Re: Problem with https over proxy

Dave,
You are not using HttpConnection class to establish connection with the
target server, are you? 

Does you code look something like this?

HttpConnection conn = new HttpConnection(...);
conn.open();
HttpState httpstate = new HttpState();
GetMethod httpget = new GetMethod("https://www.whatever.com/");
httpget.execute(conn, httpstate);

If it does, that would pretty much explain the problem, as the
connection management as well as proxy access are handled by HttpClient
class

If you want HTTPS tunneling to be taken care of automatically, you
should be using HttpClient class

HttpClient client = new HttpClient();
client.getHostConfiguration().setProxy(...);
GetMethod httpget = new GetMethod("https://www.whatever.com/");
try {
  client.executeMethod(httpget);
} finally {
  httpget.releaseConnection();
}

I may still be wrong in my assumption, but that is the only thing I can
think of that can explain this kind of problem. 

Oleg


On Thu, 2004-06-03 at 23:07, Dave Seidel wrote:
> We embed HttpClient in our product (SOAPscope), and some of our users have
> reported a problem accessing https URLs if they use a proxy server.  I
tried
> this, and can readily recreate the problem (I'm using Squid).  I used
> TcpTrace to capture one of these requests, and compared it to the same
> request peformed by FireFox.  The FireFox request gets becomes a CONNECT
> before it gets sent to the proxy, and it works fine.  But the equivalent
> request from HttpClient just goes through as a GET and fails (since Squid
> won't handle a GET over https.
>  
> What's the best way for me to fix this?  Should HttpClient handle the
> conversion from GET or POST to CONNECT, or do I have to handle it myself
in
> my client code (i.e., use ConnectMethod instead of PostMethod or
GetMethod,
> based on isSecure() && isProxied())?
>  
> - Dave Seidel, Mindreef, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail:
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
commons-httpclient-dev-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org






Mime
View raw message