Skip to content

Commit

Permalink
Output request & response in debug mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
macournoyer committed Dec 9, 2011
1 parent 3aab0ca commit 9dcb3be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/thin/protocols/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class Http < EM::Connection

def send_response(response, close_after=true)
response.finish
response.each { |chunk| send_data chunk }
response.each do |chunk|
print chunk if $DEBUG
send_data chunk
end
puts if $DEBUG

if close_after
response.close
Expand All @@ -36,6 +40,7 @@ def post_init

# Called when data is received from the client.
def receive_data(data)
puts data if $DEBUG
@parser << data
rescue HTTP::Parser::Error => e
$stderr.puts "Parse error: #{e}"
Expand Down

0 comments on commit 9dcb3be

Please sign in to comment.