caudium-devel AT caudium.net
Caudium Developer mailing list.

Re: [caudium-devel] Bug in URL variables parsing


chronological Thread 
  • From: Bertrand LUPART <bertrand.lupart AT linkeo.com>
  • To: caudium-devel AT caudium.net
  • Subject: Re: [caudium-devel] Bug in URL variables parsing
  • Date: Thu, 22 Feb 2007 01:13:37 +0100

I figured weird results in variables parsing in the URLs, when combining '+' in attributes names, and having empty variables:


?code+1=foo&code+2=bar&baz=gazonk
  "variables": ([ /* 3 elements */
      "baz": "gazonk",
      "code 1": "foo",
      "code 2": "bar"
    ]),


?code+1=foo&code+2=&baz=gazonk
  "variables": ([ /* 3 elements */
      "baz": "gazonk",
      "code 1": "foo",
      "code+2": ""
    ]),


?code+1=&code+2=&baz=gazonk
  "variables": ([ /* 3 elements */
      "code+1": "",
      "code+2": "",
      27621384: "gazonk"
    ]),


?code+1=&code+2=bar&baz=gazonk
  "variables": ([ /* 3 elements */
      "code+1": "",
      27621384: "gazonk",
      27624552: "bar"
    ]),


I didn't had these errors on 1.4.3, because some pages served with 1.4.3 now fails when served with 1.4.8.


Seems like C code strikes again.
Is there a C jockey around that could have a quick look at? :)

I think the bug is in the empty variables handler code of f_parse_query_string.

The empty variables seems not to be url-decoded:

----8<----8<----8<----8<----
$ ./test_query_string.pike "my+var=foo"
my+var=foo
([ /* 1 element */
  "my var": "foo"
])
(< >)

$ ./test_query_string.pike "my+var="
my+var=
([ ])
(< /* 1 element */
  "my+var"
>)

$ ./test_query_string.pike "my%20var="
my%20var=
([ ])
(< /* 1 element */
  "my%20var"
>)

./test_query_string.pike "my%20var=foo"
my%20var=foo
([ /* 1 element */
  "my var": "foo"
])
(< >)
---->8---->8---->8---->8----

More the only code changing from 1.2 in the f_parse_query_string method is the empty variable section.

I couldn't figure what's wrong there, yet.

--
Bertrand LUPART
                  Linkeo.com | http://www.linkeo.com/
           +33 1 72 71 71 84 | 17, rue de la Banque - F75002 Paris
        http://www.linkeo.com/signatures/bertrand-lupart/





Archive powered by MhonArc 2.6.10.

§