Skip to content

Enable socks proxy server specification#155

Merged
rogerleite merged 2 commits into
savonrb:masterfrom
maxdidato:enable_socks
Jul 16, 2015
Merged

Enable socks proxy server specification#155
rogerleite merged 2 commits into
savonrb:masterfrom
maxdidato:enable_socks

Conversation

@maxdidato

Copy link
Copy Markdown

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
Copy Markdown
Member

Thanks @maxdidato !
Closes #154

@acegilz

acegilz commented Dec 9, 2015

Copy link
Copy Markdown

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

acegilz commented Dec 9, 2015

Copy link
Copy Markdown

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
Copy Markdown
Author

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

@acegilz

acegilz commented Dec 9, 2015

Copy link
Copy Markdown

I see 😕
+1 for authentication support

@mikecmpbll

Copy link
Copy Markdown

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
Copy Markdown
Member

@mikecmpbll 👍

@acegilz

acegilz commented Dec 9, 2015

Copy link
Copy Markdown

Thank you so much @mikecmpbll

@mikecmpbll

Copy link
Copy Markdown

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

acegilz commented Dec 9, 2015

Copy link
Copy Markdown

@mikecmpbll 👍

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

@maxdidato

Copy link
Copy Markdown
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