Ruby - Socks4 proxy with WWW::Mechanize and NET::HTTP::GET -
I searched on Google and read it in the Ruby manual, but I could not find a way to WWW :: Mechanize and use Get Net :: HTTP :: on a Sox 4 proxy.
I have read, that the WWW :: MacNeak user is a subclass of agent module, and therefore -> proxy () method will work. But the manual only talks about http, ftp and gopher proxy.
Any idea how to support Sox 4? Here are the code snippets:
def get_request (url_in) url = URI.parse (url_in) req = Net :: HTTP :: Get.new (url.path, {"user-agent" => $ UserAgent}) res = Net :: HTTP.start (url.host, url.port) {| Http | Http.request (req)} returns res.body end
agent = WWW :: mechanize.new agent.user_agent_alias ('windows mozilla') page = agent.get (" Urlhere ") post_form = page.form ('post')
You probably want look at . I do not think the HTTP client has any support for SOCKS proxies; There are only HTTP proxies for HTTP.
Comments
Post a Comment