Created
February 23, 2012 06:01
-
-
Save igrigorik/1890923 to your computer and use it in GitHub Desktop.
missing content-length
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
require 'em-http' | |
EM.run do | |
r = EM::HttpRequest.new('http://localhost:24842').get | |
r.stream { |data| p [:stream, data] } | |
r.callback { p [:ok, r.response]; EM.stop } | |
r.errback { p [:fail, r.response]; EM.stop } | |
end |
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
require 'eventmachine' | |
module BadResponse | |
def receive_data(data) | |
send_data("HTTP/1.1 200 OK\n\nBody Text -- Hello!") | |
end | |
end | |
EM.run do | |
Signal.trap("INT") { EventMachine.stop } | |
Signal.trap("TERM") { EventMachine.stop } | |
EventMachine::start_server '127.0.0.1', 24842, BadResponse | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment