Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable socks proxy server specification #155

Merged
merged 2 commits into from
Jul 16, 2015

Conversation

maxdidato
Copy link

This will let a user to specify a socks proxy server in order to perform a request via it

@maxdidato maxdidato closed this Jul 16, 2015
@maxdidato maxdidato reopened this Jul 16, 2015
rogerleite added a commit that referenced this pull request Jul 16, 2015
Enable socks proxy server specification
@rogerleite rogerleite merged commit a4fdceb into savonrb:master Jul 16, 2015
@rogerleite
Copy link
Member

Thanks @maxdidato !
Closes #154

@acegilz
Copy link

acegilz commented Dec 9, 2015

how do I define user and password socks5 proxy credentials?

I am using PIA proxy but couldn't find how to connect this, already looking a solution for some days, but still stucked.

https://www.privateinternetaccess.com/forum/discussion/258/private-internet-access-proxy-now-available-now-open

mikecmpbll/betfair#6
astro/socksify-ruby#1 (comment)

@acegilz
Copy link

acegilz commented Dec 9, 2015

looking at the code it appears that socks connection block is only using host and port, while http proxy uses the 4 ( plus username and password)

Please help me I'm really confused on how to settup this socks proxy with credentials.. thanks

@maxdidato
Copy link
Author

@acegilz The pull request let the user set a socks server without authentication.

@acegilz
Copy link

acegilz commented Dec 9, 2015

I see 😕
+1 for authentication support

@mikecmpbll
Copy link

I'll take a look at this tonight, I may be able to come up with a PR because I poked around a bit at this area whilst investigating mikecmpbll/betfair#6.

@rogerleite
Copy link
Member

@mikecmpbll 👍

@acegilz
Copy link

acegilz commented Dec 9, 2015

Thank you so much @mikecmpbll

@mikecmpbll
Copy link

the code for socksify is really quite bizarre. anyways, i don't have an authenticated socks proxy which i can test against, but looking at the code you should be able to set the credentials like this:

require 'socksify/http'
uri = URI.parse('http://www.google.com/')
socks_ip = '127.0.0.1' # your socks IP
socks_port = 9050 # your socks port
TCPSocket.socks_username = "username" # socks username
TCPSocket.socks_password = "password" # socks password
Net::HTTP.SOCKSProxy(socks_ip, socks_port).start(uri.host, uri.port) do |http|
  http.get(uri.path)
end

would you be able to test this @acegilz to see if you can get a page via your socks5 proxy? there's also a PR in the works on socksify, astro/socksify-ruby#24, to improve the interface when passing through credentials, which is going to be merged this weekend i understand.

if this works for you, you can actually set the socks_username and socks_password on TCPSocket outside of httpi so you can get up and running immediately. i'll probably wait for the socksify interface to be tidied up before creating a PR here.

@acegilz
Copy link

acegilz commented Dec 9, 2015

@mikecmpbll 👍

 => #<Net::HTTPOK 200 OK readbody=true> 

@maxdidato
Copy link
Author

@mikecmpbll Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants