ruby on rails - Mechanize::ResponseCodeError: 501 -
using tor on ubuntu , trying proxify mechanize
$ tor apr 15 11:40:10.024 [notice] tor v0.2.4.21 (git-c5a648cc6f218339) running on linux libevent 2.0.19-stable , openssl 1.0.1c. apr 15 11:40:10.024 [notice] tor can't if use wrong! learn how safe @ https://www.torproject.org/download/download#warning apr 15 11:40:10.024 [notice] read configuration file "/etc/tor/torrc". apr 15 11:40:10.029 [notice] opening socks listener on 127.0.0.1:9050 apr 15 11:40:10.029 [warn] not bind 127.0.0.1:9050: address in use. tor running? apr 15 11:40:10.029 [warn] failed parse/validate config: failed bind 1 of listener ports. apr 15 11:40:10.029 [err] reading config failed--see warnings above. agent = mechanize.new agent.set_proxy('127.0.0.1', 9050) agent.user_agent_alias = 'mac safari' agent.get("http://www.linkedin.com/in/username") => mechanize::responsecodeerror: 501 => net::httpnotimplemented http://www.linkedin.com/in/username -- unhandled response /home/tristan/.rvm/gems/ruby-2.1.1/gems/mechanize-2.7.2/lib/mechanize/http/agent.rb:306:in `fetch' /home/tristan/.rvm/gems/ruby-2.1.1/gems/mechanize-2.7.2/lib/mechanize.rb:432:in `get' (irb):5 /home/tristan/.rvm/gems/ruby-2.1.1/gems/railties-4.0.4/lib/rails/commands/console.rb:90:in `start' /home/tristan/.rvm/gems/ruby-2.1.1/gems/railties-4.0.4/lib/rails/commands/console.rb:9:in `start' /home/tristan/.rvm/gems/ruby-2.1.1/gems/railties-4.0.4/lib/rails/commands.rb:62:in `<top (required)>' bin/rails:4:in `require' bin/rails:4:in `<main>' any ideas how solve this? having hard time trying proxify this! thanks!
the proxy setting in mechanize http proxy , not socks5 proxy. tor uses socks proxy , not http proxy. default opens socks proxy on port 9050.
i suggest use privoxy let pass requests on socks proxy on port 9050.
Comments
Post a Comment