Re: [Cppcms-users] Get HTTP Headers of Request
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-08-25 12:22:11
|
According to CGI specifications you should use cppcms::http::request::getenv with "HTTP_WHICH_HEADER" as parameter Note, it is up to web server to provide such variable. See <http://tools.ietf.org/html/rfc3875#section-4.1.18> Note: some web servers(like Niginx) require a list of specific headers to be passed explicitly, others may filter them. So basically you need: request().getenv("HTTP_WHICH_HEADER"); Artyom ----- Original Message ---- > From: Julian Pietron <ju...@wh...> > To: cpp...@li... > Sent: Wed, August 25, 2010 2:33:05 PM > Subject: Re: [Cppcms-users] Get HTTP Headers of Request > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 25.08.2010 13:05, schrieb augustin: > > On Wednesday 25 August 2010 06:29:35 pm Julian Pietron wrote: > >> Hi, > >> > >> how can I get a certain header sent with the client's request? I was > >> looking for a method like std::string request().header("which-header");, > >> but didn't find a method like this. > >> Could one please point me to the method I can use to get a http header? > >> The problem is, that it's a custom header, so the methods from > >> http::request for standard headers won't suffice. > > > > Hi Julian, > > > > Won't this fit your needs? > > > > void cppcms::http::response::set_header ( std::string const & name, > > std::string const & value ) > > <http://art-blog.no- > > >ip.info/cppcms_ref_v0_99/classcppcms_1_1http_1_1response.html#37b0c6c284c9d8f319a87c86d182f021> > > > > > > > I am not yet familiar which forms can headers take, but I just came across > > this, so I thought I'd mention it. > > > > > > Augustin. > > > > Hi, > > thanks for your reply, but this is not the method I need: It will set > custom headers on the response, but I need to gain a custom reader from > the request (i.e. from the HTTP request the client sent). Setting the > custom header (which is done on an Ajax request, btw) is not the problem. > > Julian > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.15 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQIcBAEBAgAGBQJMdP9xAAoJENidYKvYQHlQ78UP/RDJfXRyOPOvyt1J5eJJaBk9 > lbAJvtlFMKcZnRKtSukZ2zJfr6uFoRGAlrLrP3aOx579OvwdrkQsPzaZG1DrwTl6 > FwE0iIH25TRbhU2rxXfIRl5E/K6lo8OYE9T9NI9/7aQwSf991imKIx4P6QqmVaGF > YePh+LGFuHM25YApN7iKiBnz2k8yAe9if+ZWGwh/XmCYX5lzGyitJtU2oY6zDTFQ > 6jM7tqj/7C2zbWVWm4r8x0CE1dz7o77C6Hz2vCSXOVo/p15yqJCIhZeYdFev3DsI > KbLxpB1ReWU7LX36+fVmBS9+qJVD+46W4i7k3hkhw3b0yTB8JKsyqkVmdvQpoKj/ > lsPP9AwuIelX6eQoxW9s0ZYr7y9d0C/iDzSMvSIY6PzWFKcRNfdjmDlbyltCggoP > /7RJ7wYIfl3JaUwghOFfXyEGa4IpKYUHsIkc0kBL+YxeH+KLteIOqYOVXWihoJrB > y7CDoxlA9jHYV8jdK9MRaHQeBA5/xELexCcfSpov9eD1DcbzLD9oQ4DIRN2y8KN2 > NET1FWWIk8/fyr4tq/ovhXXWn1P2LhwhBBr5BgnkFXfRtFz/vff1u0jBB2lkCPfp > V7b2H4XndHZSaZeTDPbpiXmygl8G2oUHeIqfYRD4wfVxa6BDhtswXfv12AoXDdZP > 9Z3TfpWyJ+cOGnc5bgKy > =oQnx > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------------ > Sell apps to millions through the Intel(R) Atom(Tm) Developer Program > Be part of this innovative community and reach millions of netbook users > worldwide. Take advantage of special opportunities to increase revenue and > speed time-to-market. Join now, and jumpstart your future. > http://p.sf.net/sfu/intel-atom-d2d > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users > |