Roland

Secure connection tunneling appears to have been broken by the revision
542192 (proxy chains in HttpRoute/RouteTracker/RouteDirector). The code
below used to work for me. Now the same code causes an infinite loop in
the #establishRoute(HttpRoute, HttpContext) method and a stack overflow
as a result.
...
[DEBUG] wire - >> "CONNECT localhost:443 HTTP/1.1[EOL]"
[DEBUG] wire - >> "User-Agent: Jakarta-HttpClient/4.0[EOL]"
[DEBUG] wire - >> "Host: localhost:443[EOL]"
[DEBUG] wire - >> "Proxy-Authorization: Basic c3F1aWQ6c3F1aWQ=[EOL]"
[DEBUG] wire - >> "[EOL]"
[DEBUG] headers - >> CONNECT localhost:443 HTTP/1.1
[DEBUG] headers - >> User-Agent: Jakarta-HttpClient/4.0
[DEBUG] headers - >> Host: localhost:443
[DEBUG] headers - >> Proxy-Authorization: Basic c3F1aWQ6c3F1aWQ=
[DEBUG] wire - << "HTTP/1.0 200 Connection established[EOL]"
[DEBUG] headers - << HTTP/1.0 200 Connection established
[DEBUG] DefaultClientRequestDirector - Tunnel created
Exception in thread "main" java.lang.StackOverflowError

If I revert back to revision 541979, things get back to normal. There
were quite a bit of changes in that commit so it is not easy for me to
track down the cause of the problem. I'll make another attempt tomorrow.
Would you have time to take a look at it too?

Cheers

Oleg (sleepy and very tired)

-----------
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "UTF-8");
HttpProtocolParams.setUserAgent(params, "Jakarta-HttpClient/4.0");
HttpProtocolParams.setUseExpectContinue(params, true);

DefaultHttpClient httpclient = new DefaultHttpClient(params);

KeyStore trustStore  =
KeyStore.getInstance(KeyStore.getDefaultType());        
FileInputStream instream = new FileInputStream(new
File("my.keystore")); 
try {
    trustStore.load(instream, "nopassword".toCharArray());
} finally {
    instream.close();
}

SSLSocketFactory socketFactory = new SSLSocketFactory(trustStore);
Scheme sch = new Scheme("https", socketFactory, 443);
httpclient.getConnectionManager().getSchemeRegistry().register(sch);

httpclient.getState().setCredentials(
        new AuthScope("localhost", 443), 
        new UsernamePasswordCredentials("oleg", "oleg"));

httpclient.getState().setCredentials(
        new AuthScope("localhost", 8080), 
        new UsernamePasswordCredentials("squid", "squid"));

HttpHost targetHost = new HttpHost("localhost", 443, "https"); 
HttpHost proxy = new HttpHost("localhost", 8080); 
HttpRoute route = new HttpRoute(targetHost, null, proxy, true);

HttpGet httpget = new HttpGet("/test/");

RoutedRequest routedReq = new RoutedRequest.Impl(httpget, route); 

System.out.println("executing request: " + httpget.getRequestLine());
System.out.println("using route: " + route);

HttpResponse response = httpclient.execute(routedReq, null);
HttpEntity entity = response.getEntity();
-----------




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to