Uploaded image for project: 'Commons Net'
  1. Commons Net
  2. NET-730

Cannot connect to FTP server with HTTP proxy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.10.0
    • 3.11.0
    • FTP
    • None

    Description

      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 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.

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            jthalmai Johannes Thalmair
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: