Boost logo

Boost Users :

Subject: [Boost-users] asio problem with detecting http header end
From: Kraus Philipp (philipp.kraus_at_[hidden])
Date: 2011-07-29 16:14:12


I use Boost.ASIO for receiving Twitter JSON data. I use this code:

boost::asio::write( p_socket, l_request );
boost::asio::streambuf l_response;
boost::asio::read_until(p_socket, l_response, "\r\n\r\n");

So in my optional the l_response variable should be read the full HTTP header. But if I write it to the std::cout I get:

HTTP/1.1 200 OK
Date: Fri, 29 Jul 2011 20:08:37 GMT
Server: hi
Cache-Control: max-age=15, must-revalidate, max-age=300
Expires: Fri, 29 Jul 2011 20:13:37 GMT
Content-Type: application/json;charset=utf-8
Content-Length: 9763
Vary: Accept-Encoding
X-Varnish: 1045274856
Age: 0
Via: 1.1 varnish
X-Cache: MISS
Connection: close


I can change the "until read parameter" to \n, Connection: close or something else, but the read_until method does not stop the
reading at the correct chars. Same code on a Wikipedia call runs without problems. Can anyone help me please to receive the correct



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at