pike.git / lib / modules / Protocols.pmod / HTTP.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod:257:   //!   //! Example:   //! <pre>   //! &gt; Protocols.HTTP.http_encode_query( (["anna":"eva","lilith":"blue"]) );   //! Result: "lilith=blue&anna=eva"   //! &gt; Protocols.HTTP.http_encode_query( (["&amp;":"&","'=\"":"\0\0\0"]) );   //! Result: "%26amp%3b=%26&%27%3d%22=%00%00%00"   //! </pre>       - string http_encode_query(mapping(string:int|string) variables) + string http_encode_query(mapping(string:int|string|array(string)) variables)   {    return Array.map((array)variables, -  lambda(array(string|int) v) +  lambda(array(string|int|array(string)) v)    {    if (intp(v[1]))    return http_encode_string(v[0]); -  +  if (arrayp(v[1])) +  return map(v[1], lambda (string val) { +  return +  http_encode_string(v[0])+"="+ +  http_encode_string(val); +  })*"&";    return http_encode_string(v[0])+"="+    http_encode_string(v[1]);    })*"&";   }      //! method string http_encode_string(string in)   //! This protects all odd - see <ref>http_encode_query</ref> -   //! characters for transfer in HTTP.   //!   //! Do not use this function to protect URLs, since