title: HTTP POST Data unreadable until client closes
body: <p>I am trying to make a web server in ruby using socket for experimentation, and I am unable to get the payload from a post request until the client closes. Then, I can not send any data back when the client does close.</p>
  <p>Code:</p>
  <pre><code>require &quot;socket&quot;
  server = TCPServer.new($HOST, $PORT)
  client = server.accept
  while true
      puts client.gets
  #Prints all headers and request but I don't see the actual payload (key=value) until the client disconnects.
  end
  </code></pre>