[ 
https://issues.apache.org/jira/browse/NET-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16343146#comment-16343146
 ] 

Sebb commented on NET-650:
--------------------------

bq. If InetSocketAddress acts ...

The above is ambiguous; the InetSocketAddress constructor behaves differently 
from InetSocketAddress.createUnresolved().
Only the latter ignores local mappings.
Since that would change existing behaviour, taking that approach would need to 
be optional.

I agree that InetSocketAddress (ISA)  would need to be used somehow to solve 
the issue.
The issue is how to do it without changing existing behaviour unnecessarily.

Also note that passing existing tests does not guarantee that the behaviour is 
unchanged.
This area is difficult to test thoroughly and the tests are likely to be 
incomplete.
There are several independent conditions here:
- proxy or no proxy
- existing implementation or ISA constructor or createUnresolved
- hostname is undefined or defined locally or defined remotely or both.
That's 24 combinations without allowing for IP addresses or different ports.

In my tests, there is a problem when using names that have no mapping.
Currently this results in UnknownHostException with or without a proxy.

But with the ISA constructor it results in the following error when a proxy is 
used:
java.net.SocketException: Malformed reply from SOCKS server
Not exactly obvious, and it may vary between proxies/OSes.
I think this could problems for existing applications using NET.

There may be other differences in behaviour (other than the desired one).

Given that the problem only exists for hostnames that are not in public DNS and 
there are various simple work-rounds, I don't think the existing behaviour 
should be changed unconditionally. It may be worth adding optional behaviour to 
implement the feature.

> IMAPClient over proxy doesn't properly resolve DNS
> --------------------------------------------------
>
>                 Key: NET-650
>                 URL: https://issues.apache.org/jira/browse/NET-650
>             Project: Commons Net
>          Issue Type: Bug
>          Components: IMAP
>    Affects Versions: 3.6
>            Reporter: Matthew McGillis
>            Priority: Major
>         Attachments: imapproxy.java, imapproxy2.java, socketproxy.java
>
>
> IMAPClient when configured to use a socks proxy is not able to resolve DNS 
> names through the proxy.
> See attached sample code, if I use it with:
> {noformat}
> $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
> .:./commons-net-3.6.jar imapproxy imap.server.test.com user1 userpass
> connect error: java.net.UnknownHostException: imap.server.test.com: unknown 
> error
> {noformat}
> vs if I use it with the appropriate IP:
> {noformat}
> $ java -DsocksProxyHost=localhost -DsocksProxyPort=16003 -cp 
> .:./commons-net-3.6.jar imapproxy 10.250.3.127 user1 userpass
> * OK IMAP4rev1 proxy server ready
> IMAP: 10.250.3.127 143
> AAAA LOGIN *******
> AAAA OK [CAPABILITY IMAP4rev1 ACL BINARY CATENATE CHILDREN CONDSTORE ENABLE 
> ESEARCH ESORT I18NLEVEL=1 ID IDLE LIST-EXTENDED LIST-STATUS LITERAL+ 
> LOGIN-REFERRALS MULTIAPPEND NAMESPACE QRESYNC QUOTA RIGHTS=ektx SASL-IR 
> SEARCHRES SORT THREAD=ORDEREDSUBJECT UIDPLUS UNSELECT WITHIN XLIST] LOGIN 
> completed
> AAAB LOGOUT
> * BYE 10.250.3.127 Zimbra IMAP4rev1 server closing connection
> AAAB OK LOGOUT completed
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to