Re: [cgi-devel] truncated post variable
Status: Beta
Brought to you by:
drrngrvy
From: <jc...@ol...> - 2011-09-27 02:17:35
|
Hi Darren I am facing a similar issue again. I wish I could build a small program reproducing the error but somehow I am unable. I must confess that I am lost in the maze of all those classes, functions... I would like to get an idea of the post data that the library is getting from the webserver before any parsing, so that I could know if the issue is inside the CGI library or around the webserver Any idea on how I could do that? Thanks JCR > Hi JC, > > On 6 September 2011 00:18, <jc...@ol...> wrote: > >> Hello Darren, >> >> I am struggling with the following issue. On a linux box with nginx as >> the >> webserver >> >> on the client's side, I am making the following jquery call: >> >> function sign_up() >> { >> $("#sign_up_feedback").html('').hide(); >> $.post >> ( "/", >> { task: 'sign_up', >> member_username: >> $('#member_username').val(), >> member_password: >> $('#member_password').val(), >> member_password_repeat: >> $('#member_password_repeat').val(), >> member_first_name: >> $('#member_first_name').val(), >> member_last_name: >> $('#member_last_name').val(), >> member_phone: $('#member_phone').val(), >> member_email: $('#member_email').val(), >> member_corporation_id: >> $('#member_corporation_id').val(), >> member_unit: $('#member_unit').val(), >> member_card_number: >> $('#member_card_number').val(), >> member_card_expiration: >> $('#member_card_expiration').val() >> }, >> function(data) >> { >> $("#sign_up_feedback").html(data).show(); >> } >> ); >> } >> > > Look fine. > > >> I have used similar functions, thousands of times but, this time,when I >> read the post values server side >> using >> print_variables_(req.post, "POST"); >> with >> template<typename Map> >> void >> print_variables_(Map& m, std::string title) >> { >> std::ostringstream os; >> os << title << "\n"; >> if (m.empty()) >> { >> os << "NONE\n"; >> } >> else >> { >> for(typename Map::const_iterator i = m.begin(); i != m.end(); ++i) >> { >> os << i->first << " = " << i->second << "\n"; >> } >> } >> os << "\n"; >> write_to_file("~/log_requests", os.str()); >> } >> > > Ok. > > >> member_card_number is truncated to member_card! I looked at the http >> headers and the nginx logs and member_card_number is not truncated. >> > > That's odd. Is it just member_card_number that is truncated? Are all of > the > other parameters ok? > > >> I am very puzzled here as this has never really happened to me. >> Where in the source code of the CGI library could I see where the >> parsing >> of the http header is done? >> > > These functions live in: > > http://svn.boost.org/svn/boost/sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/extract_params.hpp > http://svn.boost.org/svn/boost/sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.ipp > > There's also parse_url_encoded_form() in: > > http://svn.boost.org/svn/boost/sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/form_parser.ipp > > which will get called for POST params.* > > Although I can't imagine how you're ending up seeing what you're seeing. > Could you provide a minimal compilable file I can try? > > Cheers, > Darren > > * wow I really need to commit this newer code, trunk isn't looking it's > best > I'm afraid. :( > |