[
https://issues.apache.org/jira/browse/DIRMINA-801?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Emmanuel Lecharny resolved DIRMINA-801.
---------------------------------------
Resolution: Fixed
I applied the suggested patch in :
http://svn.apache.org/viewvc?rev=1040105&view=rev
It will be available in MINA 2.0.2
Thanks for the patch !
> SOCKS4 proxy logic erroneously sends server hostname
> ----------------------------------------------------
>
> Key: DIRMINA-801
> URL: https://issues.apache.org/jira/browse/DIRMINA-801
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.0
> Environment: Mac OS X, Java 1.6.0
> Reporter: Donnie Pinkston
>
> When attempting a SOCKS4 connection through a proxy to an HTTP server, I
> found that the server was seeing a hostname as the first line of the HTTP
> request. This obviously confused the server, which was expecting the "GET
> ... HTTP/1.x" line first.
> I was constructing my proxy-request with this code, since I had an
> InetSocketAddress object:
> req = new SocksProxyRequest(
> SocksProxyConstants.SOCKS_VERSION_4,
> SocksProxyConstants.ESTABLISH_TCPIP_STREAM,
> serverAddr, // An InetSocketAddress object including both
> hostname and IP address
> username);
> I think this is being caused in
> org.apache.mina.proxy.handlers.socks.Socks4LogicHandler, specifically the
> writeRequest() method. This method assumes that a SOCKS4a connection-attempt
> is being made (as opposed to plain-vanilla SOCKS4) if the
> SocksProxyRequest.getHost() method doesn't return null, but this method will
> pull the hostname from the InetSocketAddress if it's available. This causes
> a situation where the IP address in the SOCKS4 request is valid (i.e. not
> 0.0.0.x), but the hostname is still sent. AFAIK, according to SOCKS4a, the
> hostname should only be sent when the IP-address is set to 0.0.0.x.
> I would propose replacing this line:
> boolean isV4ARequest = request.getHost() != null;
> with something like this line:
> boolean isV4ARequest = Arrays.equals(request.getIpAddress(),
> SocksProxyConstants.FAKE_IP);
> (or the more dangerous but much faster request.getIpAddress() ==
> SocksProxyConstants.FAKE_IP)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.