Glee!

Nov. 13th, 2007 08:41 pm
elfs: (Default)
[personal profile] elfs
These mean nothing to you (but they might make sense to [livejournal.com profile] fallenpegasus):

foo
foo&bar
foo&baz&21342&$@#
foo=zoom&bar&bob=ted=carol=alice
foo&$=
foo&%66%64%65
foo&%66%64%65=zoom
%66%64%65=zoom& foo&
foo
bar&foo
%24%40%23&21342&baz&foo
bar&bob=ted%3Dcarol%3Dalice&foo=zoom
%24=&foo
fde&foo
fde=zoom&foo
&%20foo&fde=zoom


I got the QUERY_INFO string sort and normalize function to work! Whoohoo! Now, on to the rest of the signature!

(Note the fourth example: the input fragment is 'bob=ted=carol=alice', but the equal symbol is a URI reserved character, a CGI argument, and an unreserved initial symbol separating keys from values in CGI arguments and is privileged in the standard; I made the decision to normalize the very first unescaped, but to escape every instance thereafter. I suspect this will not please some people, but it is the best interpretation I can come up with inside the mashup between the specification and RFC 3986).

(Note also the last example with the preceeding '&'; this happens when an empty argument is passed in, i.e. a QUERY_INFO contains '&&'; the empty string bubbles up to the top of the sort list according to asciibetical sorting.)

Date: 2007-11-14 03:35 pm (UTC)
bolindbergh: (Default)
From: [personal profile] bolindbergh

Missing case 1: foo=baz&foo=&foo

Missing case 2: foo=bar%3Dbaz&foo%3Dbar=baz

Date: 2007-11-14 04:51 pm (UTC)
From: [identity profile] elfs.livejournal.com
1: foo%3Dbar=baz&foo=bar%3Dbaz

2: foo%3Dbar=baz&foo=bar%3Dbaz

I realized after I posted this that there's a very big bug in the middle of it, unfortunately. It's possible to present a string of unreserved characters as a sequence of escapes, meaning they would be sorted incorrectly.

It's a very big bug, unfortunately, that's going to require some code shuffling. The code arguments are going to have to be fragmented, then normalized, then sorted, then reassembled. I was hoping to do the normalization in-place.

It would be pathological to have CGI arguments presented as both strings and a series of escape sequences, but browsers and HTTP clients have been known to do some very pathological things.

Date: 2007-11-16 01:36 am (UTC)
bolindbergh: (Default)
From: [personal profile] bolindbergh
So whoever specified this didn't supply a reference implementation and a test suite?

Profile

elfs: (Default)
Elf Sternberg

December 2025

S M T W T F S
 12345 6
78910111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 4th, 2026 07:34 pm
Powered by Dreamwidth Studios