pike.git / lib / modules / Standards.pmod / URI.pike

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:518:   protected constant url_from = sprintf("%c", url_chars[*]);   protected constant url_to = sprintf("%%%02x", url_chars[*]);      string http_encode(string in)   {    // We shouldn't really have to soft case here. Bug(ish) in constant    // type generation...    return replace(in, [array(string)]url_from, [array(string)]url_to);   }    - //! Return the query part, coded according to RFC 1738. + //! Return the query part, coded according to RFC 1738, or zero.   string get_http_query() { -  mapping(string:string) out = ([]); -  foreach(get_query_variables(); string name; string value) -  out[http_encode(name)] = http_encode(value); -  return ((array)out)[*]*"="*"&"; +  return query;   }      //! Return the path and query part of the URI, coded according to RFC   //! 1738.   string get_http_path_query() { -  return http_encode(((path||"")/"/")[*])*"/" + -  (query?"?"+get_http_query():""); +  string q = get_http_query(); +  return http_encode(((path||"")/"/")[*])*"/" + (q?"?"+q:"");   }         string _sprintf(int how, mapping|void args)   {    string look, _host = host, getstring;    switch(how)    {    case 't':    return "Standards.URI";