require 'webrick' server = WEBrick::HTTPServer.new(:Port => ARGV.first) server.mount_proc '/' do |req, res| puts req.body end trap 'INT' do server.shutdown end server.start
启动:ruby print_http_body.rb 8000
ruby print_http_body.rb 8000