Hello,
I'm using HttpClient-4 and I'm trying to proxy SSL connections over a
special proxy.
To do this I've created my own SocketFactory that is a copy of the
SSLSocketFactory provided in the source.
I've modified the function:
Socket connectSocket(Socket sock,
String host,
int port,
InetAddress localAddress,
int localPort,
HttpParams params)
throws IOException,
UnknownHostException,
ConnectTimeoutException
so that it creates a socket to my proxy and performs my handshake with
it then creates new SSLSocket over the top of it. It then returns that
new SSL socket.
The docs say that this functions returns:
"the connected socket. The returned object may be different from
the sock argument if this factory supports a layered protocol. "
and so I didn't think there would be any issue. HttpClient, however,
appears to use the old sock argument socket and not the returned one.
A quick peek at the source showed:
In org.apache.http.impl.conn.DefaultClientConnectionOperator:
117 final SocketFactory sf = schm.getSocketFactory();
118
119 Socket sock = sf.createSocket();
120 conn.opening(sock, target);
121
122 try {
123 sock = sf.connectSocket(sock, target.getHostName(),
124 schm.resolvePort(target.getPort()),
125 local, 0, params);
126 } catch (ConnectException ex) {
127 throw new HttpHostConnectException(target, ex);
128 }
129 prepareSocket(sock, context, params);
130 conn.openCompleted(sf.isSecure(sock), params);
I would expect conn to be notified of the new value of sock returned
by sf.connectSocket(...);
Am I misunderstanding SocketFactories?
Thanks,
Connell
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]