Re: [Cppcms-users] Custom Headers in request()
Brought to you by:
artyom-beilis
|
From: Artyom <art...@ya...> - 2010-11-28 17:46:16
|
Hello,
I think I answered this question ones. But anyway
CppCMS uses CGI based API, in order to read some
header like X-Foo-Bar you need to read environment
variable HTTP_X_FOO_BAR (See [1]) However
some web servers do not pass all headers for example
nginx passes only headres defined explicitly in fastcgi
configuration, so the behavior may vary between the servers.
Cppcms has API for it cppcs::http::request::getenv()
see [2]. So basically all you need is to call getenv()
for CGI variable.
[1] RFC3875 Common Gateway Interface v 1.1 Protocol-Specific
Meta-Variables at http://www.ietf.org/rfc/rfc3875
[2]
http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1request.html#e1027cdea2ba8a41a041269df8092ae3
and
http://art-blog.no-ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1request.html#92bc86f75e4e1f9480967ce3fd1e4f65
Artyom
> hi,
>
> the cppcms::http::request class only provides access to predefined
> headers. now i try to implement CORS (http://www.w3.org/TR/cors/) in
> which case the browser sends 'Access-Control-Request-Method' and
> 'Access-Control-Request-Headers' headers whcih i cannot access using the
> existing methods (or am i mistaken?).
>
> would it be possible to make a method available which returns a map of
> all headers as sent by the browser? (something like
> std::map<std::string,std::string> cppcms::http::request::http_headers())
>
> thanks
>
> frank
|