Guest User

Untitled

a guest
Jan 24th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. @uri = URI.parse 'someurl'
  2. @http = Net::HTTP::new(@uri.host, @uri.port)
  3. @http.use_ssl = true
  4. @http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  5. store = OpenSSL::X509::Store.new
  6. store.set_default_paths
  7. @http.cert_store = store
  8.  
  9. uri = @uri
  10. formatted_params = params.to_a.map { |param| "#{param[0]}=#{param[1]}" }.join("&")
  11. uri.query = URI.escape formatted_params
  12. request = Net::HTTP::Get.new uri.path + '?' + uri.query
  13. request.basic_auth @user, @password
  14. response = @http.request(request)
  15.  
  16. Net::HTTP::Proxy(proxy_addr, proxy_port).start('www.example.com') {|http|
  17. puts http.body.get
  18. }
Add Comment
Please, Sign In to add comment