/** * sends an HTTP response with content, but not content-length provided * * @param request the HTTP request to respond to * @param tcp_conn the TCP connection to send the response over */ void sendResponseWithContentButNoLength(HTTPRequestPtr& request, TCPConnectionPtr& tcp_conn) { // make sure it will get closed when finished tcp_conn->setLifecycle(TCPConnection::LIFECYCLE_CLOSE); // prepare the response headers HTTPResponse http_response(*request); http_response.setDoNotSendContentLength(); // send the response headers boost::system::error_code error_code; http_response.send(*tcp_conn, error_code); BOOST_REQUIRE(! error_code); // send the content buffer tcp_conn->write(boost::asio::buffer(m_big_buf, BIG_BUF_SIZE), error_code); BOOST_REQUIRE(! error_code); // finish (and close) the connection tcp_conn->finish(); }