-
-
Save mrkplt/06cbd785ac25d4e5b580 to your computer and use it in GitHub Desktop.
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
# extracted from http://www.thekua.com/atwork/2011/07/ruby-script-to-capture-http-traffic/ | |
require 'webrick' | |
include WEBrick | |
class Simple < WEBrick::HTTPServlet::AbstractServlet | |
def do_POST(request, response) | |
puts "Body: " + request.body | |
puts "Header: " + request.raw_header.to_s | |
response.status = 200 | |
end | |
end | |
server = HTTPServer.new(:Port => 5899) | |
server.mount "/", Simple | |
['TERM', 'INT'].each do |signal| | |
trap(signal){ server.shutdown } | |
end | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment