You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2009/06/07 09:56:08 UTC
[jira] Closed: (DIRMINA-652)
Socks5LogicHandler.encodeProxyRequestPacket(final SocksProxyRequest
request) should check that the result of request.getEndpointAddress() is
resolved before using it
[ https://issues.apache.org/jira/browse/DIRMINA-652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Lecharny closed DIRMINA-652.
-------------------------------------
> Socks5LogicHandler.encodeProxyRequestPacket(final SocksProxyRequest request) should check that the result of request.getEndpointAddress() is resolved before using it
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DIRMINA-652
> URL: https://issues.apache.org/jira/browse/DIRMINA-652
> Project: MINA
> Issue Type: Bug
> Affects Versions: 2.0.0-M5
> Reporter: Dan Mihai Dumitriu
> Assignee: Edouard De Oliveira
> Fix For: 2.0.0-M5
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Depending on what is going on in layers above this one, the InetSocketAddress returned by request.getEndpointAddress() could be unresolved, in which case the hostname should be used.
> private IoBuffer encodeProxyRequestPacket(final SocksProxyRequest request)
> throws UnsupportedEncodingException {
> int len = 6;
> byte[] host = request.getHost() != null ? request.getHost().getBytes(
> "ASCII") : null;
> InetSocketAddress adr = request.getEndpointAddress();
> byte addressType = 0;
> if (adr != null && !adr.isUnresolved()) {
> if (adr.getAddress() instanceof Inet6Address) {
> len += 16;
> addressType = SocksProxyConstants.IPV6_ADDRESS_TYPE;
> } else if (adr.getAddress() instanceof Inet4Address) {
> len += 4;
> addressType = SocksProxyConstants.IPV4_ADDRESS_TYPE;
> }
> } else {
> len += 1 + host.length;
> addressType = SocksProxyConstants.DOMAIN_NAME_ADDRESS_TYPE;
> }
> IoBuffer buf = IoBuffer.allocate(len);
> buf.put(request.getProtocolVersion());
> buf.put(request.getCommandCode());
> buf.put((byte) 0x00); // Reserved
> buf.put(addressType);
> if (addressType == SocksProxyConstants.DOMAIN_NAME_ADDRESS_TYPE) {
> buf.put((byte) host.length);
> buf.put(host);
> } else {
> buf.put(request.getIpAddress());
> }
> buf.put(request.getPort());
> return buf;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.