Thread: [Cppcms-users] Get HTTP Headers of Request
Brought to you by:
artyom-beilis
From: Julian P. <ju...@wh...> - 2010-08-25 10:29:45
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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. Thanks, Julian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMdPCPAAoJENidYKvYQHlQBvwQAK+eWPqeP/bayq8oNQ9Wg1+F wSLEBDQNBCbxQaYSVuy/b5eRluRMajlTO01YUtTB3FONPXUnemx9H3qQLE4WRO3w s8JyQVjys5yNJxKp8N2KeuhW6+x3RMyZugyK7KUdN2jJKpW1KZE3I5vdAFOqZkPl TthVw1Xt91FhU72K21muP+N4zFPScev01q90BuFvnl2WkTqqNTAYV/8Eh4cZMlVo 9ujVEP7WKagA4rw2M3DcTKTCDuMJzxu6k/QhYCTZ3eZOMplo2GztXkcODT40HFnn ZPRnCQRT9NRgNlj9I0EZ3Re7UONbXvvDNSBs/1xYQApqB3/SoWIayqRebi+wox+n eIhiwuUS1TgPMoGV5/rqQqqzYdS6HOaakirD1hTJHehKwRY8lvKz4xWSH393cZME 4sLjYAKC/i3Bi+F+Bzj5JacnMHfYMFJicz2GlkslEjBeogdOFD6eakEtQ0/2UCFM DDywIdx3Ppf7f+nd6FXpVzSK1b4T7VEuQ65zjv+4jg0cNGpYznv+D1kdYs376vby w55pfTyatLwXQtN7GhQN1R+obnx/tSjdbO/sGYKc8erNEqZB7gwrCa+vTL4FuIIe jsKdXk68M1xlFuh67WWQcxg+ZYZFwj7N8YDAfljfpTccHmPymGmbHVq8T62ALxJt OINSzO+zvh82S9AYpsxT =uwT0 -----END PGP SIGNATURE----- |
From: augustin <aug...@ov...> - 2010-08-25 11:09:11
|
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. -- Friends: http://www.reuniting.info/ http://activistsolutions.org/ My projects: http://astralcity.org/ http://3enjeux.overshoot.tv/ http://linux.overshoot.tv/ http://overshoot.tv/ http://charityware.info/ http://masquilier.org/ http://openteacher.info/ http://minguo.info/ http://www.wechange.org/ http://searching911.info/ . |
From: Julian P. <ju...@wh...> - 2010-08-25 11:33:17
|
-----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----- |
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 > |