Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3948

Show
Ignore:
Timestamp:
10/01/08 01:45:56 (2 months ago)
Author:
kris
Message:

fixes #1161 :: tango.net.Uri handles relative paths incorrectly

Thanks Ralith

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/net/Uri.d

    r3681 r3948  
    601601                char    c; 
    602602                int     i,  
    603                         mark,  
    604                         len = uri.length; 
     603                        mark; 
     604                auto    prefix = path; 
     605                auto    len = uri.length; 
    605606 
    606607                reset; 
     
    625626                   if (relative && uri[0] != '/') 
    626627                      { 
    627                       uri = toLastSlash(path) ~ uri; 
     628                      uri = toLastSlash(prefix) ~ uri; 
    628629                      query = fragment = null; 
    629630                      len = uri.length; 
     
    823824        private final char[] toLastSlash (char[] path) 
    824825        { 
    825                 for (char*p = path.ptr+path.length; --p >= path.ptr;) 
    826                      if (*p is '/') 
    827                          return path [0 .. (p-path.ptr)+1]; 
     826                if (path.ptr) 
     827                    for (auto p = path.ptr+path.length; --p >= path.ptr;) 
     828                         if (*p is '/') 
     829                             return path [0 .. (p-path.ptr)+1]; 
    828830                return path; 
    829831        }