Johannes Thalmair created NET-730:
-------------------------------------

             Summary: Cannot connect to FTP server with HTTP proxy
                 Key: NET-730
                 URL: https://issues.apache.org/jira/browse/NET-730
             Project: Commons Net
          Issue Type: Bug
          Components: FTP
    Affects Versions: 3.10.0
            Reporter: Johannes Thalmair


After updating from Commons Net 3.9.0 to 3.10.0, I can no longer connect to an 
FTP server with an HTTP proxy that requires authorization. Sadly I do not have 
direct access to that server and don't know which proxy is running there. A try 
to connect just blocks for 5 minutes and then fails with an IOException: No 
response from proxy

    at org.apache.commons.net.ftp.FTPHTTPClient .tunnelHandshake(FTPHTTPClient 
.java:209)

    at org.apache.commons.net.ftp.FTPHTTPClient .connect(FTPHTTPClient 
.java:173)

 

I'm using the org.apache.commons.net.ftp.FTPHTTPClient for connecting and 
already did some debugging. The change that causes my problem is the switch 
from the deprecated 
org.apache.commons.net.util.Base64.{{{}encodeToString(byte[]){}}} to 
java.util.Base64.getEncoder().encodeToString({{{}byte[]{}}}) to encode the 
Proxy-Authorization header in FTPHTTPClient.tunnelHandshake() (see [link commit 
on 
github|[https://github.com/apache/commons-net/commit/396bade29ad98d20a2c039ac561db56b63018b39]).]
 The old encoding method added a CRLF / "\r\n" to the end of the String, while 
the new one does not. This specific proxy seems to expect it, I don't know if 
others do, too.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to