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

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:87:    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.   //! @param something   //! Compare the URI to this - int `==(mixed something) + protected int `==(mixed something)   {    if( !objectp( something ) || object_program(something) < this_program )    return false;    Standards.URI other = [object(Standards.URI)]something;    // For protocols with host/port/user/password we do lower_case on    // the host when comparing, and use the port according to RFC 2396    // section 6.    return    ((host    && other->host
pike.git/lib/modules/Standards.pmod/URI.pike:399:   //! When supplied, will root the URI a the given location. This is   //! needed to correctly verify relative URIs, but may be left out otherwise.   //! If left out, and uri is a relative URI, an error is thrown.   //! @param uri   //! When uri is another URI object, the created   //! URI will inherit all properties of the supplied uri   //! except, of course, for its base_uri.   //! @throws   //! An exception is thrown if the @[uri] is a relative URI or only a   //! fragment, and missing a @[base_uri]. - void create(this_program|string uri, + protected void create(this_program|string uri,    this_program|string|void base_uri)   {    DEBUG("create(%O, %O) called!", uri, base_uri);    sprintf_cache = ([]);    if(stringp(uri))    raw_uri = [string]uri; // Keep for future runs of reparse_uri after a base_uri change    else if(objectp(uri)) // If uri is 0, we want to inherit from the base_uri.    raw_uri = uri->raw_uri;       reparse_uri(base_uri);   }      //! Assign a new value to a property of URI   //! @param property   //! When any of the following properties are used, properties that   //! depend on them are recalculated: user, password, host, port, authority, base_uri.   //! @param value   //! The value to assign to @[property] - mixed `->=(string property, mixed value) { return `[]=(property, value); } - mixed `[]=(string property, mixed value) + protected mixed `->=(string property, mixed value) { +  return `[]=(property, value); + } + protected mixed `[]=(string property, mixed value)   {    DEBUG("`[]=(%O, %O)", property, value);    sprintf_cache = ([]);    switch(property)    {    case "user":    case "password":    case "host":    if(!stringp(value) && value!=0)    error("%s value not string.\n", property);
pike.git/lib/modules/Standards.pmod/URI.pike:610:    return query;   }      //! Return the path and query part of the URI, coded according to   //! @rfc{1738@}.   string get_http_path_query() {    string q = get_http_query();    return http_encode(((path||"")/"/")[*])*"/" + (q?"?"+q:"");   }    - int __hash() { return hash_value(_sprintf('s')); } + protected int __hash() { return hash_value(_sprintf('s')); }      private mapping(int:string) sprintf_cache = ([]); - string _sprintf(int how, mapping|void args) + protected string _sprintf(int how, mapping|void args)   {    if( how == 't' ) return "Standards.URI";    if( string res = sprintf_cache[how] )    return res;    string look, _host = host, getstring;    if(how == 'x' && _host)    _host = lower_case(_host);    getstring = (path||"") + (query ? "?" + query : "");    if(args && args->flag_left)    return getstring;