Sha256: e21d032c2d5aff44b2a51c5ed0699876fa6afbd7d91355ee19562bd76173f850
Contents?: true
Size: 558 Bytes
Versions: 15
Compression:
Stored size: 558 Bytes
Contents
require 'rubygems' require 'eventmachine' require '../lib/em-http' urls = ARGV if urls.size < 1 puts "Usage: #{$0} <url> <url> <...>" exit end pending = urls.size EM.run do urls.each do |url| http = EM::HttpRequest.new(url).get http.callback { puts "#{url}\n#{http.response_header.status} - #{http.response.length} bytes\n" puts http.response pending -= 1 EM.stop if pending < 1 } http.errback { puts "#{url}\n" + http.errors.join("\n") pending -= 1 EM.stop if pending < 1 } end end
Version data entries
15 entries across 15 versions & 2 rubygems