Skip to content

FTP Connection with Ruby 2.4/2.5 #34

@dlahn

Description

@dlahn

We are currently using Socksify to proxy FTP connections through our SOCKS proxy. This has been working for years in Ruby 2.3 (and older versions.)

I've upgraded to Ruby 2.5 (and 2.4), and noticed that it no longer seems to proxy the FTP connections, while an HTTP connection will work fine. Here is some example code.

require 'socksify'
Socksify::debug = true
TCPSocket::socks_server = '...'
TCPSocket::socks_port = ...
require 'net/ftp'
require 'net/http'
Socksify::proxy('...', ...) do |soc|
  uri = URI('https://api.ipify.org?format=json')
  puts Net::HTTP.get(uri)
  ftp = Net::FTP.new
  ftp.debug_mode = true
  ftp.connect('...', 21)
end

With the above code, I can see in the debug that it connects to the SOCKS proxy, and then to the HTTP example using the SOCKS proxy, but it does not for the FTP connection. Downgrading to 2.3 shows the proper behaviour of both connecting through the SOCKS proxy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions