Hi,
I'm trying to use cpp-netlib 0.9 to implement a simple client.
But I'm having trouble getting a response header , I've read the example
http_client.cpp.
In that example you use an iterator to print all the headers.. however I saw
in :
headers.cpp :
struct response_headers_wrapper { ...
range_type operator[] (string_type const & key) const {
return message_.headers().equal_range(key);
}
I would like to use the headers wrapper to call directly like :
using namespace boost::network;
typedef http::basic_client<http::tags::http_default_8bit_tcp_resolve, 1,
1> http_client;
http_client client;
std::string req_str = "http://localhost/";
http_client::request request(req_str);
request << header("Connection", "close");
http_client::response response = client.get(request);
This section here is my problem :
headers_range<http_client::response>::type headers OR
basic_response<Tag>::headers_container_type = response.headers(); ???
const string<tags::default_string>::type cookie_header("Set-Cookie");
TYPE ?? = headers[cookie_header]
But really I'm having a hard time figuring out the correct types... with the
tags etc.. Still quite new to me.
Especially the range_type.. I got a feeling it should return
a basic_response<Tag>::headers_container_type .. and that should be the
wrapper? But i'm not sure what the tag should be.. or anyway I feel quite
lost.
A simple example that would illustrate how to get a std::string for a
specific header would help me to understand quite a lot
Thank you!
Antoine Tremblay
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cpp-netlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel