app.rb
require 'socket'
require_relative 'HttpRequest.rb'
server = TCPServer.new 80
while request = server.accept
while (line = request.gets)
p line
end
request.close
end
发送的请求为:
POST HTTP/1.1
Host: 127.0.0.1:80
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: 9955d109-301b-476e-9bc5-2612c0ef5f5c
sss=sss&%E6%98%AF%E6%98%AF%E6%98%AF=%E6%98%AF+%E6%90%9C%E7%B4%A2
这样是无法获取sss=sss&%E6%98%AF%E6%98%AF%E6%98%AF=%E6%98%AF+%E6%90%9C%E7%B4%A2, 请问有什么办法能够获取整个 Http request 的内容么?