Hi, On 5 January 2011 20:16, Nick Mathewson <ni...@freehaven.net> wrote: > On Thu, Dec 30, 2010 at 8:21 PM, Mihai Draghicioiu > <mihai.draghici...@gmail.com> wrote: >> Hi all. I've found that evhttp_parse_query_str only works if the query >> string is of the form foo=bar&baz=quux. If we have a query string of >> the form foo=bar&baz (no value for the last key), it fails. I consider >> this a bug, because you have all the other valid parameters in there, >> and it can just set NULL for the value of the baz parameter. I believe >> the behavior of evhttp_parse_query() is different (correct). I had >> used evhttp_parse_query() until now, and switched to >> evhttp_parse_query_str() and discovered this bug. > > I'll repost my question from > https://sourceforge.net/tracker/?func=detail&aid=3037662&group_id=50884&atid=461322 > : > > === > So, RFC3986 says that the query part of a URL can be any sequence of > characters in a given set, without providing any instructions on how to > encode or decode them. > > The only place that i can find the key=val&key2=val2 format expressed, on > the other hand, is in the HTML standard, which doesn't define anything > about parameters without values. > > So I'm inclined to say that this is not-a-bug: If the query parameters are > not encoded in the HTML-standard way, then absent some other standard, then > decoding the Request-URI from the Request-Line is up to the library user, > right? > > Is there a standard I'm missing here? > === > > In other words, according to what standard is foo=bar&baz to be > interpreted? If we're considering generic URIs, there is no > particular interpretation to the query part. If we're considering GET > requests generated by HTML forms, I think it's invalid, if I'm reading > the HTML spec right. So according to what standard does foo=bar&baz > have an interpretation? >
None, unfortunately this has never been standardized. The URI RFC merely states that the query-string is the part from ? to # as I'm sure you know, but leaves the interpretation of it to the user. On Wikipedia <http://en.wikipedia.org/wiki/Query_string> one finds: * The query string is composed of a series of field-value pairs. * The field-value pairs are each separated by an equals sign. * The series of pairs is separated by the ampersand, '&' or semicolon, ';'. which seems to be the most sane text on the subject (also note the part on the encoding there). > [snip] > > > yrs, > -- > Nick Regards, Jeroen Habraken *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.