Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing request headers in cpp-netlib http server
    primarykey
    data
    text
    <p>I've begun developing an HTTP server using <code>cpp-netlib</code> (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:</p> <pre><code>void operator()(async_server::request const &amp;Request, async_server::connection_ptr pConnection) { http::impl::request_headers_wrapper&lt;http::tags::http_async_server&gt; Headers = headers(Request); } </code></pre> <p>But according to the definition of <code>not_quite_pod_request_base</code> in <code>headers.hpp</code> 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 <code>headers_container.hpp</code>:</p> <pre><code>namespace boost { namespace network { template &lt;class Tag&gt; struct headers_container { typedef std::multimap&lt; typename string&lt;Tag&gt;::type, typename string&lt;Tag&gt;::type &gt; type; }; } // namespace network } // namespace boost </code></pre> <p>So can anyone either point out why there is a such redefinition or am I missing some way to actually get the <code>multimap</code> or is the wrapper with the <code>vector</code> the "go-to" way to work with headers in <code>cpp-netlib</code>? At least to me it seems that a <code>multimap</code> would be much easier to work with. </p> <p><strong>UPDATE</strong></p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload