|
From: Raindog <ra...@ma...> - 2011-01-09 23:44:03
|
On 1/9/2011 1:32 PM, David Hite wrote:
> Howdy all,
>
> I've just started working with cpp-netlib and I am trying to get an
> HTTP server (not asynchronous) working with different mime Content-Types.
>
> I see that the FileServer example sets the mime-type for different
> responses in the asynchronous server connection_ptr but I can't get
> anything like it to work for a simple synchronous server response.
>
> Can anyone give an example of how to set the Content-Type header for a
> simple synchronous server response?
>
> Thanks,
> -Dave-
http_client_t::request login_req(url);
http_client_t client;
login_req << net::header("Content-Length",
boost::lexical_cast<std::string>(auth_string.length()));
login_req << net::header("Content-Type",
"application/x-www-form-urlencoded");
login_req << net::body(auth_string);
http_client_t::response auth_resp = client.post(login_req);
|