Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @uri = URI.parse 'someurl'
- @http = Net::HTTP::new(@uri.host, @uri.port)
- @http.use_ssl = true
- @http.verify_mode = OpenSSL::SSL::VERIFY_PEER
- store = OpenSSL::X509::Store.new
- store.set_default_paths
- @http.cert_store = store
- uri = @uri
- formatted_params = params.to_a.map { |param| "#{param[0]}=#{param[1]}" }.join("&")
- uri.query = URI.escape formatted_params
- request = Net::HTTP::Get.new uri.path + '?' + uri.query
- request.basic_auth @user, @password
- response = @http.request(request)
- Net::HTTP::Proxy(proxy_addr, proxy_port).start('www.example.com') {|http|
- puts http.body.get
- }
Add Comment
Please, Sign In to add comment