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

version» Context lines:

pike.git/lib/modules/Protocols.pmod/HTTP.pmod/module.pmod:731:      //! Encodes a query mapping to a string;   //! this protects odd - in http perspective - characters   //! like '&' and '#' and control characters,   //! and packs the result together in a HTTP query string.   //!   //! Example:   //! @pre{   //! > Protocols.HTTP.http_encode_query( (["anna":"eva","lilith":"blue"]) );   //! Result: "lilith=blue&anna=eva" - //! > Protocols.HTTP.http_encode_query( (["&":"&","'=\"":"\0\0\0"]) ); - //! Result: "%26amp%3b=%26&%27%3d%22=%00%00%00" + //! > Protocols.HTTP.http_encode_query( (["&":"&","'=\"":"\0\0\0\u0434"]) ); + //! Result: "%27%3D%22=%00%00%00%D0%B4&%26amp%3B=%26"   //! @}   string http_encode_query(mapping(string:int|string|array(string)) variables)   {    return Array.map((array)variables,    lambda(array(string|int|array(string)) v)    {    if (intp(v[1]))    return uri_encode(v[0]);    if (arrayp(v[1]))    return map(v[1], lambda (string val) {