Skip to content

Instantly share code, notes, and snippets.

@deepfryed
Created December 10, 2010 03:20
Show Gist options
  • Save deepfryed/735710 to your computer and use it in GitHub Desktop.
Save deepfryed/735710 to your computer and use it in GitHub Desktop.
em-http fail
#!/usr/bin/env ruby1.9.1
require 'em-http'
EM.run do
url = "http://www.scribd.com:80/doc/45016088/He-Spake-and-It-Was-Done"
http = EM::HttpRequest.new(url).get timeout: 10
http.callback { puts "done"; EM.stop };
http.errback {|res| puts "error\n"; p res.response_header; EM.stop }
end
-----------------------------------------------------------------------------------
error
{"SERVER"=>"nginx/0.7.67", "DATE"=>"Fri, 10 Dec 2010 03:17:38 GMT", "CONTENT_TYPE"=>"text/html; charset=utf-8", "TRANSFER_ENCODING"=>"chunked", "CONNECTION"=>"keep-alive", "X_POWERED_BY"=>"Phusion Passenger (mod_rails/mod_rack) 2.2.14", "X_RUNTIME"=>"564ms", "STATUS"=>"200 OK", "AGE"=>"943", "X_CACHE"=>"HIT from squid01.local", "VIA"=>"1.1 squid01.local:3128 (squid/2.7.STABLE9)", "EXPIRES"=>"Fri, 10 Dec 2010 03:17:37 GMT", "CACHE_CONTROL"=>"no-cache", "X_SERVED_BY"=>"cache", "X_PAGE_TYPE"=>"docview"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment