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

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:109:    && other->port == port    && other->user == user    && other->password == password)    || (other->authority == authority))    && other->path == path    && other->query == query    && other->scheme == scheme    && other->fragment == fragment;   }    - string combine_uri_path(string base, string rel) + string combine_uri_path(string base, string rel, int(0..1)|void is_abs_path)   {    string buf = rel;    array segments;       // RFC 2396, §5.2.5:    // If the path component begins with a slash character ("/"),    // then the reference is an absolute-path and we skip to step 7.    //    // NB: The RFC does not take into account that even absolute    // paths may contain segments of ".." and ".", and this    // function may get called by external code that wants    // to get rid of them. We simply ignore the base URI's    // path if rel is absolute.    if (!has_prefix(rel, "/")) {    // RFC 2396, §5.2.6:    // a) All but the last segment of the base URI's path component is    // copied to the buffer. In other words, any characters after the    // last (right-most) slash character, if any, are excluded.    segments = base/"/"; -  +  if ((sizeof(segments) > 1) || is_abs_path) {    buf = segments[..<1]*"/"+"/"; -  +  } else { +  buf = ""; +  }       // b) The reference's path component is appended to the buffer string.    buf += rel;    }    segments = buf / "/";       // c) All occurrences of "./", where "." is a complete path segment,    // are removed from the buffer string.    for(int i=0; i<sizeof(segments)-1; i++)    if(segments[i]==".")
pike.git/lib/modules/Standards.pmod/URI.pike:364:    if(!has_prefix(path, "/"))    {       // 6) If this step is reached, then we are resolving a relative-path    // reference. The relative path needs to be merged with the base    // URI's path. Although there are many ways to do this, we will    // describe a simple method using a separate string buffer.       DEBUG("Combining base path %O with path %O => %O",    this::base_uri->path, path, -  combine_uri_path(this::base_uri->path, path)); -  path = combine_uri_path(this::base_uri->path, path); +  combine_uri_path(this::base_uri->path, path, +  !!this::base_uri->authority)); +  path = combine_uri_path(this::base_uri->path, path, +  !!this::base_uri->authority);       }    }       // 7) The resulting URI components, including any inherited from the    // base URI, are recombined to give the absolute form of the URI reference.    // (Reassembly is done at cast-to-string/sprintf() time)   }