title: boost asio https post request with empty body
body: <p>I'm sending a post request over a tcp socket using the boost asio library. On the server side the request is received but there's no params, what's going on?</p>
  
  <pre><code>boost::asio::streambuf request_;
  std::string postfields ("username=user1&amp;password=any");
  std::ostream request_stream(&amp;request_);
  request_stream &lt;&lt; "POST " &lt;&lt; /somepath &lt;&lt; " HTTP/1.1\r\n";
  request_stream &lt;&lt; "Host: " &lt;&lt; somehost.com &lt;&lt; "\r\n";
  request_stream &lt;&lt; "User-Agent: C/1.0" &lt;&lt; "\r\n";
  request_stream &lt;&lt; "Content-Type: application/x-www-form-urlencoded \r\n";
  request_stream &lt;&lt; "Accept: application/json\r\n";
  request_stream &lt;&lt; "Content-Length: " &lt;&lt; postfields.length() &lt;&lt; "\r\n"
  request_stream &lt;&lt; "Connection: close\r\n\r\n";
  request_stream &lt;&lt; postfields;
  request_stream &lt;&lt; "\n\n"; // tried with and without this line
  
  boost::asio::async_write(socket_, request_,
                        boost::bind(&amp;client::handle_write_request, shared_from_this(),
                                boost::asio::placeholders::error));
  
  </code></pre>
  
  <p>When I print the request it looks like this</p>
  
  <pre><code>POST /somepath HTTP/1.1
  Host: somehost.com
  User-Agent: C/1.0
  Content-Type: application/x-www-form-urlencoded
  Accept: application/json
  Connection: close
  
  username=user1&amp;password=any
  </code></pre>
  
  <p>On the serverside the body is empty, there's no params. What could be wrong here?</p>
  
  <p>Please don't mark this as duplicate as I've exhausted all the stackoverflow questions similar to this. Thanks</p>