Skip to content

Instantly share code, notes, and snippets.

@MadanThangavelu
Created May 7, 2013 22:54
Show Gist options
  • Save MadanThangavelu/5536845 to your computer and use it in GitHub Desktop.
Save MadanThangavelu/5536845 to your computer and use it in GitHub Desktop.
Query local https server in parallel
require File.expand_path(File.join(File.dirname(__FILE__), '../test_helper'))
require 'net/https'
require 'uri'
threads = []
(1..32).each do |page|
threads << Thread.new(page) { |myPage|
uri = URI.parse("https://localhost:8443")
h = Net::HTTP.new(uri.host, uri.port)
h.use_ssl = true
h.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = h.request(request)
puts response.body
}
end
threads.each { |aThread| aThread.join }
sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment