httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

SOCKS proxy support

Open mchesler opened this issue 12 years ago • 3 comments

HTTPClient does not appear to support SOCKS proxies unless I'm missing something blatantly obvious. Works fine with rest-client as:

RestClient.proxy = "http://username:[email protected]"
response = RestClient.get(url)

Attempting to do the same with HTTPClient as below results in an "invalid" response which I believe is coming from the proxy.

client = HTTPClient.new("http://username:[email protected]")
client.get(url)

mchesler avatar Aug 21 '13 14:08 mchesler

You should be able to set the user and password manually: http://rubydoc.info/gems/httpclient/2.1.5.2/HTTPClient#set_proxy_auth-instance_method

However, when I try this I get an exception (see below). @mchesler if possible I'd like to know if when you set the user and password manually you get the same exception:

HTTPClient::BadResponseError: unexpected EOF
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:904:in `block in parse_header'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/timeout.rb:87:in `timeout'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:875:in `parse_header'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:836:in `connect_ssl_proxy'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:758:in `block in connect'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/timeout.rb:87:in `timeout'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:751:in `connect'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:609:in `query'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient/session.rb:164:in `query'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient.rb:1083:in `do_get_block'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient.rb:887:in `block in do_request'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient.rb:981:in `protect_keep_alive_disconnected'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient.rb:886:in `do_request'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient.rb:774:in `request'
    from /app/.bundle/gems/ruby/1.9.1/gems/httpclient-2.3.4.1/lib/httpclient.rb:677:in `get'
    from (irb):74
    from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.20/lib/rails/commands/console.rb:44:in `start'
    from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.20/lib/rails/commands/console.rb:8:in `start'
    from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.20/lib/rails/commands.rb:23:in `'
    from script/rails:6:in `require'
    from script/rails:6:in `
'irb(main):075:0>

JoshMcKin avatar Oct 15 '13 19:10 JoshMcKin

Sorry @JoshMcKin - I no longer have access to the systems where this was a problem.

mchesler avatar Oct 17 '13 21:10 mchesler

@mchesler, I've had to migrate to Excon which does support SOCKS proxy.

Thanks

JoshMcKin avatar Oct 21 '13 14:10 JoshMcKin