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:
http://live.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/http/client/sync_client.cpp

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: " << "musicobsession.com" << "\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 hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net