http - Is there a spec for nested urlencoded params[]? -


at 1 point in history, server side languages started tweaking urlencoded parameters add support submitting data arrays , key/value objects:

// key/value pairs contact[name]=john contact[phone]=800-555-1234  // arrays foo[]=bar foo[]=baz 

i’m playing around edge cases in 1 library's nested parameter parsing, eg preservation of parameter order. there spec formalizes how server should process encoding? if not, reference implementation introduced syntax?

square brackets in uris

according rfc-3986 "uniform resource identifier (uri): generic syntax" using unencoded square brackets in uris isn't allowed. therefore it's not http standard.

a host identified internet protocol literal address, version 6 [rfc3513] or later, distinguished enclosing ip literal within square brackets ("[" , "]"). place square bracket characters allowed in uri syntax.

many programming languages using square brackets arrays, therefore guess natural carry-over use square brackets in uris.

is there spec formalizes how server should process encoding?

no, @ least not language independent.

first implementation

a lot of web application frameworks allow reuse of same key in query create array, example http://example.org/?foobar=hello&foobar=world. these frameworks allow use square brackets in keys, makes no difference, part of name. associative arrays supported. (caveat: i'm not familiar languages.)

  • perl, 1987: numbered arrays supported, not associative arrays.
  • php, 1995: supports numbered arrays associative arrays.
  • active server pages (asp), 1996: numbered arrays supported, not associative arrays.
  • javaserverpages (jsp), 1999: numbered arrays supported, not associative arrays.
  • jax-rs (java), 2008: numbered arrays supported, not associative arrays.

so far php language i've found, supports associative arrays in urls without custom code.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -