i am trying to send a put request to simple server in ruby with data.
curl --request PUT 'http://localhost:2000/api/kill' --data "c=19"
my server implementation is:
require 'socket'
server = TCPServer.open(2000)
loop do
socket = server.accept
while(line = socket.gets)
p line
end
socket.close
end
i want to extract the data from the request. Currently it only prints the following.
"PUT /api/kill HTTP/1.1\r\n"
"User-Agent: curl/7.35.0\r\n"
"Host: localhost:2000\r\n"
"Accept: */*\r\n"
"Content-Length: 4\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"\r\n"
Any help regarding how to extract c=19 sent as data