Search code examples
c++cpp-netlib

cpp netlib headers


I am having some trouble understanding the cpp netlib documentation.

member name  type               description
headers      vector<header>     Vector of headers.

A header is a struct of type response_header<http::tags::http_server>. 
An instance always has the members name and value both of which are of type string_type.
string_type is boost::network::string<http::tags::http_server>::type.

In my code when I try to access the headers:

http_server::response_header headers[] = request.headers;

the above doesn't compile. I understand this might seem pretty basic, but I am new to c++. Can anyone guide me on how to iterate through the headers from request?


Solution

  • I figured out the solution, for the sake of anyone else googling this. It seems that the documentation is wrong. Request_header should be used when parsing a request not response header