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.27 2008/01/05 14:28:05 grubba Exp $ + // $Id: URI.pike,v 1.28 2008/06/28 16:36: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:42:   string raw_uri;      #ifdef STANDARDS_URI_DEBUG   #define DEBUG(X, Y ...) werror("Standards.URI: "+X+"\n", Y)   #else   #define DEBUG(X, Y ...)   #endif      // Parse authority component (according to RFC 1738, § 3.1)   // Updated to RFC 3986 $ 3.2. - static void parse_authority() + protected void parse_authority()   {    // authority = [ userinfo "@" ] host [ ":" port ]    if(sscanf(authority, "%[^@]@%s", string userinfo, authority) == 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
pike.git/lib/modules/Standards.pmod/URI.pike:65:    // IP-literal = "[" ( IPv6address / IPvFuture ) "]"    // IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )    sscanf(authority, "[%s]%*[:]%d", host, port);    } else {    sscanf(authority, "%[^:]%*[:]%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. :-) - static void inherit_properties(this_program uri) + protected void inherit_properties(this_program uri)   {    authority = uri->authority;    scheme = uri->scheme;    user = uri->user; password = uri->password;    host = uri->host; query = uri->query;    port = uri->port;    path = uri->path; fragment = uri->fragment;   }      //! Compare this URI to something, in a canonical way.
pike.git/lib/modules/Standards.pmod/URI.pike:439:   //! existing ones. Will overwrite all existing variables with the same   //! names.   void add_query_variables(mapping(string:string) vars) {    set_query_variables(get_query_variables()|vars);   }         // HTTP stuff      // RFC 1738, 2.2. URL Character Encoding Issues - static constant url_non_corresponding = enumerate(0x21) + + protected constant url_non_corresponding = enumerate(0x21) +    enumerate(0x81,1,0x7f); - static constant url_unsafe = ({ '<', '>', '"', '#', '%', '{', '}', + protected constant url_unsafe = ({ '<', '>', '"', '#', '%', '{', '}',    '|', '\\', '^', '~', '[', ']', '`' }); - static constant url_reserved = ({ ';', '/', '?', ':', '@', '=', '&' }); + protected constant url_reserved = ({ ';', '/', '?', ':', '@', '=', '&' });      // Encode these chars - static constant url_chars = url_non_corresponding + url_unsafe + + protected constant url_chars = url_non_corresponding + url_unsafe +    url_reserved + ({ '+', '\'' }); - static constant url_from = sprintf("%c", url_chars[*]); - static constant url_to = sprintf("%%%02x", url_chars[*]); + 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.   string get_http_query() {
pike.git/lib/modules/Standards.pmod/URI.pike:535:    "%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"}));   }    +