Created
December 10, 2010 03:20
-
-
Save deepfryed/735710 to your computer and use it in GitHub Desktop.
em-http fail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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