Re: [xSocket-develop] xsocket ssl through proxy problem
Status: Inactive
Brought to you by:
grro
|
From: Gregor R. <gre...@go...> - 2008-06-26 05:31:10
|
Hi Grant,
this seems to be a bug. I supposes xSocket interprets the http connection as
'non persistent' by receiving the CONNECT response. This could be the reason
why the connection is disconnected.
Please file the bug
Thanks
Gregor
2008/6/25 Poladian, Grant <gra...@ci...>:
>
> First, very nice job with this library. Its very well organized and works
> well.
> Currently, using xsocket 2.1 and http 2.0 beta 1.
>
> When connecting to https server through a proxy the following combination
> does not work.
>
> --------------------------------------------
> HttpRequest connect_http = new HttpRequest("CONNECT","somecompany.com:443
> ");
> ...
> NonBlockingConnection proxy_conn = new NonBlockingConnection("proxy.net
> ",8080,ssl_context,false);
> HttpClientConnection http_conn = new HttpClientConnection (proxy_conn);
>
> IHttpResponse connect_response = proxy_conn.call(connect_http);
>
> Thread.sleep(2000);
> System.out.println("Activating Secure Mode ...");
> http_conn.activateSecureMode();
>
> Getting the following exception:
>
> Activating Secure Mode ...
> java.nio.channels.ClosedChannelException
> at
> org.xsocket.connection.AbstractNonBlockingStream.readByteBufferByLength(AbstractNonBlockingStream.java:546)
> at
> org.xsocket.connection.NonBlockingConnection.readByteBufferByLength(NonBlockingConnection.java:1259)
> at
> org.xsocket.connection.NonBlockingConnection.activateSecuredMode(NonBlockingConnection.java:1212)
> at
> org.xsocket.connection.http.AbstractHttpConnection.activateSecuredMode(AbstractHttpConnection.java:429)
> --------------------------------------------
>
> However, the following works fine
>
> --------------------------------------------
> static String CONNECT_STRING = "CONNECT somecompany.com:443 HTTP/1.1\r\n"
> +"Connection: keep-alive\r\n"
> +"Proxy-Connection: keep-alive\r\n"
> +"Pragma: no-cache\r\n"
> +"Keep-Alive: 300\r\n"
> +"Host: somecompany.com:443\r\n"
> +"\r\n";
> NonBlockingConnection proxy_conn = new NonBlockingConnection("proxy.net
> ",8080,ssl_context,false);
> proxy_conn.write(CONNECT_STRING);
> proxy_conn.flush();
>
> while(not_finished_reading) {
> proxy_conn.read(...)
> }
>
> proxy_conn.activateSecuredMode();
> --------------------------------------------
>
> After stepping through the code a bit it seems that the channel is being
> closed after the CONNECT
> request is processed. So the subsequent handshake fails. You need to be
> stepping in the dispather and main
> threads to see this.
>
> Regards,
> Grant
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> xSocket-develop mailing list
> xSo...@li...
> https://lists.sourceforge.net/lists/listinfo/xsocket-develop
>
>
|