diff options
-rw-r--r-- | ChangeLog-99b | 1 | ||||
-rw-r--r-- | websvcs/lib/URL_Addr.cpp | 24 |
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index bc5a1cc3aa5..beacaa3196e 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -7,6 +7,7 @@ Thu Feb 4 23:11:26 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * websvcs/lib/URL_Addr.cpp: Fixed minor memory allocation problem for invalid HTTP addresses. + It removes './' when creating relative addresses. Wed Feb 03 21:50:09 1999 David L. Levine <levine@cs.wustl.edu> diff --git a/websvcs/lib/URL_Addr.cpp b/websvcs/lib/URL_Addr.cpp index 439e4d130c2..19054c3a601 100644 --- a/websvcs/lib/URL_Addr.cpp +++ b/websvcs/lib/URL_Addr.cpp @@ -327,13 +327,15 @@ path_copy (LPCTSTR begin, switch (c) { case '/': - if (*(src + 1) == '.' - && (*src + 2) == '.' - && (*src + 3) == '/') + if (src[1] == '.' && src[2] == '.' && url[3] == '/') { while (target != begin && *(--target) != '/'); src += 3; } + else if (src[1] == '.' && src[2] == '/') + { + src += 2; + } else { *target = c; @@ -396,10 +398,20 @@ ACE_HTTP_Addr::create_relative_address (LPCTSTR url) const // Go back to the last / to remove the basename. while (target != buf && *(--target) != '/'); // Go back if we begin with '../' - while (url[0] == '.' && url[1] == '.' && url[2] == '/') + while ((url[0] == '.' && url[1] == '.' && url[2] == '/') + || (url[0] == '.' && url[1] == '/')) { - while (target != buf && *(--target) != '/'); - url += 3; + if (url[1] == '.') + { + // A ../ go back + while (target != buf && *(--target) != '/'); + url += 3; + } + else + { + // A ./ remove + url += 2; + } } *target = '/'; ++target; |