I'm implementing a small HTTP server with Ruby using Mongrel. My code currently looks like this:
require 'mongrel.rb'
class SimpleHandler < Mongrel::HttpHandler
def process(request, response)
puts request.body # outputs #<StringIO:0xb7656e74>
response.start(200) do |head,out|
head["Content-Type"] = "application/ocsp-responder"
out.write("hello!\n")
end
end
end
h = Mongrel::HttpServer.new("127.0.0.1", "5000")
h.register("/", SimpleHandler.new)
h.run.join
As you can see in my sample, request.body does not output the POST data. How can I get it?