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

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:1:   #pike __REAL_VERSION__      //! This class implements URI parsing and resolving of relative references to   //! absolute form, as defined in RFC 2396 and RFC 3986.      // Implemented by Johan Sundström and Johan Schön. - // $Id: URI.pike,v 1.19 2005/03/30 18:26:23 grubba Exp $ + // $Id: URI.pike,v 1.20 2005/03/31 00:25:59 nilsson Exp $      #pragma strict_types      //! Scheme component of URI   string scheme;      //! Authority component of URI (formerly called net_loc, from RFC 2396   //! known as authority)   string authority;   
pike.git/lib/modules/Standards.pmod/URI.pike:340:   mixed `->=(string property, mixed value) { return `[]=(property, value); }   mixed `[]=(string property, mixed value)   {    DEBUG("`[]=(%O, %O)", property, value);    switch(property)    {    case "user":    case "password":    case "host":    case "port": +  if(!stringp(value)) +  error("%s value not string.\n", property);    ::`[]=(property, value);    authority = (user ? user + (password ? ":" + password : "") + "@" : "") +    (host?(has_value(host, ":")?("["+host+"]"):host):"") +    (port != Protocols.Ports.tcp[scheme] ? ":" + port : "");    return value;       case "authority": -  +  if(!stringp(value)) error("authority value not string.\n");    authority = [string]value;    parse_authority(); // Set user, password, host and port accordingly    return value;       case "base_uri": -  +  if(!stringp(value) || !(objectp(value) && ([object]value)->reparse_uri)) +  error("base_uri value neither object nor string.\n");    reparse_uri([object(this_program)|string]value);    return base_uri;       case "scheme":    /* RFC 3986 §3.1    *    * An implementation should accept uppercase letters as equivalent    * to lowercase in scheme names (e.g., allow "HTTP" as well as    * "http") for the sake of robustness but should only produce    * lowercase scheme names for consistency.    */ -  value = lower_case(value); +  if(!stringp(value)) error("scheme value not string.\n"); +  value = lower_case([string]value);       // FALL_THROUGH    default:    return ::`[]=(property, value); // Set and return the new value    }   }      //! When cast to string, return the URI (in a canonicalized form).   //! When cast to mapping, return a mapping with scheme, authority, user, password, host,   //! port, path, query, fragment, raw_uri, base_uri as documented above.