All pastes #759062 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-11-02 20:10 UTC
rendered paste body
require 'net/http'
pages = %w( www.rubycentral.com slashdot.org www.google.com )
threads = []
for page_to_fetch in pages
  threads << Thread.new(page_to_fetch) do |url|
    h = Net::HTTP.new(url,80)
    puts "Fetching: #{url}"
    resp = h.get('/', nil )
    puts "Got #{url}: #{resp.message}"    
  end
end
threads.each {|thr| thr.join }