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

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:47:   #endif      // 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, authority) == 2) +  if(sscanf(authority, "%[^@]@%s", string userinfo, host_port) == 2)    {    // 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(authority, "[")) { +  if (has_prefix(host_port, "[")) {    // IP-literal = "[" ( IPv6address / IPvFuture ) "]"    // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) -  sscanf(authority, "[%s]%*[:]%d", host, port); +  sscanf(host_port, "[%s]%*[:]%d", host, port);    } else {    // IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet    // reg-name = *( unreserved / pct-encoded / sub-delims ) -  sscanf(authority, "%[^:]%*[:]%d", host, port); +  sscanf(host_port, "%[^:]%*[:]%d", host, port);    }    DEBUG("parse_authority(): host=%O, port=%O", host, port);   }      // Inherit all properties except raw_uri and base_uri from the URI uri. :-)   protected void inherit_properties(this_program uri)   {    authority = uri->authority;    scheme = uri->scheme;    user = uri->user; password = uri->password;
pike.git/lib/modules/Standards.pmod/URI.pike:573:       if(how == 'O')    return "URI(\"" + look + "\")";    else    if(args && args->flag_left)    return getstring;    else    return look;   }    + // Master codec API function. Allows for serialization with + // encode_value. + mapping(string:string|int|this_program) _encode() + { + #define P(X) #X:X +  return ([ +  P(scheme), +  P(authority), +  P(path), +  P(query), +  P(fragment), +  P(host), +  P(user), +  P(password), +  P(port), +  P(base_uri), +  P(raw_uri), +  // variables is only a cache +  ]); + #undef P + } +  + // Master codec API function. Allows for deserialization with + // decode_value. + void _decode(mapping m) + { +  foreach(m; mixed index; mixed value) +  ::`[]=(index, value); + } +  + #if 0   // Not used yet.   string quote(string s)   {    return replace(s,    ({ "\000", "\001", "\002", "\003", "\004", "\005", "\006",    "\007", "\010", "\011", "\012", "\013", "\014", "\015",    "\016", "\017", "\020", "\021", "\022", "\023", "\024",    "\025", "\026", "\027", "\030", "\031", "\032", "\033",    "\034", "\035", "\036", "\037", "\200", "\201", "\202",    "\203", "\204", "\205", "\206", "\207", "\210", "\211",
pike.git/lib/modules/Standards.pmod/URI.pike:597:    ({ "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",    "%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F",    "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17",    "%18", "%19", "%1A", "%1B", "%1C", "%1D", "%1E", "%1F",    "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87",    "%88", "%89", "%8A", "%8B", "%8C", "%8D", "%8E", "%8F",    "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97",    "%98", "%99", "%9A", "%9B", "%9C", "%9D", "%9E", "%9F",    "%20", "%25", "%27", "%22"}));   } + #endif