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

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:49:   // FIXME: What about decoding of Percent-Encoding (RFC3986 2.1)?   // cf pct-encoded in the functions below.      // Parse authority component (according to RFC 1738, § 3.1)   // Updated to RFC 3986 $ 3.2.   // NOTE: Censors the userinfo from the @[authority] variable.   protected void parse_authority()   {    string host_port = authority;    // authority = [ userinfo "@" ] host [ ":" port ] -  if(sscanf(authority, "%[^@]@%s", string userinfo, host_port) == 2) -  { +  array(string) a = authority/"@"; +  if (sizeof(a) > 1) { +  host_port = a[-1]; +  string userinfo = a[..<1] * "@";    // userinfo = *( unreserved / pct-encoded / sub-delims / ":" )    sscanf(userinfo, "%[^:]:%s", user, password); // user info present    DEBUG("parse_authority(): user=%O, password=%O", user, password);    }    if(scheme)    port = Protocols.Ports.tcp[scheme]; // Set a good default á la RFC 1700    // host = IP-literal / IPv4address / reg-name    if (has_prefix(host_port, "[")) {    // IP-literal = "[" ( IPv6address / IPvFuture ) "]"    // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )