Boost logo

Boost Users :

Subject: [Boost-users] asio HTTP client example always returns error 400
From: G S (stokestack_at_[hidden])
Date: 2010-08-24 18:38:34

Hi all.

I copied the boost::asio HTTP client example code:

and just replaced the argv stuff with a hard-coded domain name and
"index.html". It appears to make the socket connection OK, but the
response to the request is 400 ("bad request"). Is there something
wrong with this request?

                boost::asio::streambuf request;
                std::ostream request_stream(&request);
                request_stream << "GET " << "index.html" << " HTTP/1.0\r\n";
                request_stream << "Host: " << "" << "\r\n";
                request_stream << "Accept: */*\r\n";
                request_stream << "Connection: close\r\n\r\n";

It doesn't matter what host I use (as long is it's real). Thanks for
any insight!

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