I've begun developing an HTTP server using cpp-netlib
(stable release 0.10.1) and from the available documentation I am not sure how to access HTTP request headers in a server handler. I am aware that it can be done using the wrapper like this:
void operator()(async_server::request const &Request, async_server::connection_ptr pConnection)
{
http::impl::request_headers_wrapper<http::tags::http_async_server> Headers = headers(Request);
}
But according to the definition of not_quite_pod_request_base
in headers.hpp
this is actually a vector of pairs, which is hard for searching if i want to e.g. find if a certain header is present. If there are no other options then of course i will stick with this, however it seems that initially it was meant as a multimap at least judging from headers_container.hpp
:
namespace boost { namespace network {
template <class Tag>
struct headers_container {
typedef std::multimap<
typename string<Tag>::type,
typename string<Tag>::type
> type;
};
} // namespace network
} // namespace boost
So can anyone either point out why there is a such redefinition or am I missing some way to actually get the multimap
or is the wrapper with the vector
the "go-to" way to work with headers in cpp-netlib
? At least to me it seems that a multimap
would be much easier to work with.
UPDATE
I also took a quick look at the POCO libraries but could not understand if their authentication classes are meant for only client sessions or server as well? If anyone can give a hint on this, maybe I can still do a switch to POCO if that makes life a lot easier.