Publish the spec behind the Micrsoft Querystring Parsing and Serialization rules #67
Description
Could we get some light shed on the whys/hows of querystring handling logic in vNext? Previous versions have been inconsistent at best, and this seems like a great chance to fix things.
An all-encompassing parsing strategy may be possible, but inadvisable, as the logic could not be clearly communicated to developers. I would suggest instead that parsing/serialization formats be named specifically for their appropriate use.
For example, requests with content-type application/x-www-form-urlencoded
must follow the WHATWG parsing/serialization spec — which differs from php, ruby, node, python, classic asp, and each implementation in asp.net vNow, most of which have differing rules on one or more points:
- Handling of duplicate keys. (error, replace, concatenate, or build list)?
- Hash serialization.
key[a]=1&key[b]=2
produceskey = {a=1, b=2}
in some implementations - Array serialization.
a=1&a=2
,a=1,2
,a[]=1&a[]=2
,a[1]=1
, a[2]=2` are all valid ways to represent an array value on different platforms. - Handling of invalid characters (error, or pretend they were URL encoded)?
- Encoding of reserved characters (Most frameworks fail to url encode reserved characters correctly)
- Order preservation - some developers (inadvisably) rely on the order of querystring pairs. A recent instance of this is in the latest version of Umbraco.
- Case preservation and case sensitivity.
- URL decoding pass count (AFAIK, only ASP.NET WebForms messes this up). Ideally,
+
,%20
->
Once we know the team's opinions on querystrings (and paths - and PathInfos), I think there are a lot of developers that would be happy to pitch in with unit tests and compatibility profiles. I imagine that Javascript/Node and php compatibility would be the highest priority.
Of course, this is easiest if we can ensure that we do not lose any data between the network packet and the developer. I'm looking at you, IIS.