You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Eric Hermanson <er...@alum.mit.edu> on 2007/01/31 00:44:45 UTC

Taking advantage of HTTPClient below the 'top' layer?

Hello,

Please excuse this potentially naive question, but I have been  
searching the HTTPClient codebase today and I can't seem to put my  
finger on where I can 'plug' into the code to take advantage of the  
Proxy connection and authentication pieces only.  In other words, I  
don't want to use the HTTPClient class to send/receive data, I want  
to use my custom Socket connection as-is.

My existing Proxy code looks like this:

                     Socket tunnel = new Socket(proxyHost,  
proxyPort.intValue());
		    doTunnelHandshake(tunnel, serverAddress,  
clientRequestsListeningPort);
                     Socket clientRequestsSocket =  
((javax.net.ssl.SSLSocketFactory)sslSocketFactory()).createSocket 
(tunnel, serverAddress, clientRequestsListeningPort, true);
		    ... from here on I use my own input/output streams...

Where 'doTunnelHandshake' is my custom Proxy connection code which is  
turning out to be way too simplistic (i.e. doesn't support Digest,  
NTLM, or Custom authorization).  Can anyone give me a quick heads up  
on where I can start to convert this code to use the Proxy  
authentication in HTTPClient and then communicate over my socket as I  
normally would?

Thank You,
Eric


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


Re: Taking advantage of HTTPClient below the 'top' layer?

Posted by Michael Becke <mb...@gmail.com>.
Yep, that's probably what you're looking for.

Mike

On 1/30/07, Eric Hermanson <er...@alum.mit.edu> wrote:
> Hmmm, I may have answered my own question.  It appears
> org.apache.commons.httpclient.ProxyClient is what I need.
>
> Thanks,
> Eric
>
>
> On Jan 30, 2007, at 3:44 PM, Eric Hermanson wrote:
>
> > Hello,
> >
> > Please excuse this potentially naive question, but I have been
> > searching the HTTPClient codebase today and I can't seem to put my
> > finger on where I can 'plug' into the code to take advantage of the
> > Proxy connection and authentication pieces only.  In other words, I
> > don't want to use the HTTPClient class to send/receive data, I want
> > to use my custom Socket connection as-is.
> >
> > My existing Proxy code looks like this:
> >
> >                     Socket tunnel = new Socket(proxyHost,
> > proxyPort.intValue());
> >                   doTunnelHandshake(tunnel, serverAddress,
> > clientRequestsListeningPort);
> >                     Socket clientRequestsSocket =
> > ((javax.net.ssl.SSLSocketFactory)sslSocketFactory()).createSocket
> > (tunnel, serverAddress, clientRequestsListeningPort, true);
> >                   ... from here on I use my own input/output streams...
> >
> > Where 'doTunnelHandshake' is my custom Proxy connection code which
> > is turning out to be way too simplistic (i.e. doesn't support
> > Digest, NTLM, or Custom authorization).  Can anyone give me a quick
> > heads up on where I can start to convert this code to use the Proxy
> > authentication in HTTPClient and then communicate over my socket as
> > I normally would?
> >
> > Thank You,
> > Eric
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-
> > help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>

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


Re: Taking advantage of HTTPClient below the 'top' layer?

Posted by Eric Hermanson <er...@alum.mit.edu>.
I've been searching the Java net documentation and I found a few  
interesting things:

First, it appears as if NTLM authentication was added to J2SE in  
version 1.5.0_08.

	http://java.sun.com/j2se/1.5.0/ReleaseNotes.html
	http://java.sun.com/javase/6/docs/technotes/guides/net/http-auth.html

Second, as of 1.5.0, Sun added a Proxy class that allows you to  
create a socket that talks through a Proxy:

	http://java.sun.com/j2se/1.5.0/docs/guide/net/proxies.html


So my question is, with these J2SE technologies available, do they  
accomplish what the Apache ProxyClient class does for me, i.e.,  
tunnel a secure socket through any type of proxy (Basic, Digest,  
NTLM) with relative ease?  I've looked over the Apache code and I  
find it very clean and impressive, but I wonder if it's worth the  
additional jar dependencies if I can get the same work done through  
the standard J2SE?  ProxyClient apperas to do everything for you,  
including figuring out the type of proxy and making the connection  
behind the scenes.  There may be a bit more work involved in the J2SE  
approach (i.e. figuring out for yourself what type of proxy is  
involved).  I would appreciate any input from others who have looked  
at this situation.

Thank You,
Eric




On Jan 30, 2007, at 6:45 PM, Eric Hermanson wrote:

> Hmmm, I may have answered my own question.  It appears  
> org.apache.commons.httpclient.ProxyClient is what I need.
>
> Thanks,
> Eric
>
>
> On Jan 30, 2007, at 3:44 PM, Eric Hermanson wrote:
>
>> Hello,
>>
>> Please excuse this potentially naive question, but I have been  
>> searching the HTTPClient codebase today and I can't seem to put my  
>> finger on where I can 'plug' into the code to take advantage of  
>> the Proxy connection and authentication pieces only.  In other  
>> words, I don't want to use the HTTPClient class to send/receive  
>> data, I want to use my custom Socket connection as-is.
>>
>> My existing Proxy code looks like this:
>>
>>                     Socket tunnel = new Socket(proxyHost,  
>> proxyPort.intValue());
>> 		    doTunnelHandshake(tunnel, serverAddress,  
>> clientRequestsListeningPort);
>>                     Socket clientRequestsSocket =  
>> ((javax.net.ssl.SSLSocketFactory)sslSocketFactory()).createSocket 
>> (tunnel, serverAddress, clientRequestsListeningPort, true);
>> 		    ... from here on I use my own input/output streams...
>>
>> Where 'doTunnelHandshake' is my custom Proxy connection code which  
>> is turning out to be way too simplistic (i.e. doesn't support  
>> Digest, NTLM, or Custom authorization).  Can anyone give me a  
>> quick heads up on where I can start to convert this code to use  
>> the Proxy authentication in HTTPClient and then communicate over  
>> my socket as I normally would?
>>
>> Thank You,
>> Eric
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-user- 
>> unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: httpclient-user- 
>> help@jakarta.apache.org
>>
>


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


Re: Taking advantage of HTTPClient below the 'top' layer?

Posted by Eric Hermanson <er...@alum.mit.edu>.
Hmmm, I may have answered my own question.  It appears  
org.apache.commons.httpclient.ProxyClient is what I need.

Thanks,
Eric


On Jan 30, 2007, at 3:44 PM, Eric Hermanson wrote:

> Hello,
>
> Please excuse this potentially naive question, but I have been  
> searching the HTTPClient codebase today and I can't seem to put my  
> finger on where I can 'plug' into the code to take advantage of the  
> Proxy connection and authentication pieces only.  In other words, I  
> don't want to use the HTTPClient class to send/receive data, I want  
> to use my custom Socket connection as-is.
>
> My existing Proxy code looks like this:
>
>                     Socket tunnel = new Socket(proxyHost,  
> proxyPort.intValue());
> 		    doTunnelHandshake(tunnel, serverAddress,  
> clientRequestsListeningPort);
>                     Socket clientRequestsSocket =  
> ((javax.net.ssl.SSLSocketFactory)sslSocketFactory()).createSocket 
> (tunnel, serverAddress, clientRequestsListeningPort, true);
> 		    ... from here on I use my own input/output streams...
>
> Where 'doTunnelHandshake' is my custom Proxy connection code which  
> is turning out to be way too simplistic (i.e. doesn't support  
> Digest, NTLM, or Custom authorization).  Can anyone give me a quick  
> heads up on where I can start to convert this code to use the Proxy  
> authentication in HTTPClient and then communicate over my socket as  
> I normally would?
>
> Thank You,
> Eric
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user- 
> help@jakarta.apache.org
>


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