Re: [cgi-devel] truncated post variable
Status: Beta
Brought to you by:
drrngrvy
|
From: <jc...@ol...> - 2011-09-11 17:52:31
|
Hello Darren
Thanks for the answers. I am still investigating the issue. I found a way
out by cutting the length of the name of the variable... I know, I know,
this is not even a real hack. I don't think it has anything to do with the
CGI library, I think it is more in my nginx set up. Any way, I am going to
keep on investigating that because this is really strange
Ans, yes a new release would be really nice!
JCR
> 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. :(
>
|