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

version» Context lines:

pike.git/lib/modules/Standards.pmod/URI.pike:109:    && 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 buf; +  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. -  array segments=base/"/"; -  buf=segments[..<1]*"/"+"/"; +  segments = base/"/"; +  buf = segments[..<1]*"/"+"/";       // b) The reference's path component is appended to the buffer string. -  buf+=rel; +  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]==".")    segments[i]=0;       segments -= ({ 0 });   
pike.git/lib/modules/Standards.pmod/URI.pike:336:    // use an authority component.    if(!authority || !sizeof(authority))    {    authority = this::base_uri->authority;    DEBUG("Inherited authority %O from base URI", authority);    if (authority)    parse_authority();       // 5) If the path component begins with a slash character ("/"), then    // the reference is an absolute-path and we skip to step 7. +  // +  // FIXME: What if it contains "." or ".." segments? +  // cf combine_uri_path() above.    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,