You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/02/01 12:35:30 UTC
svn commit: r1066006 - in /subversion/trunk/subversion:
libsvn_subr/dirent_uri.c tests/libsvn_subr/dirent_uri-test.c
Author: rhuijben
Date: Tue Feb 1 11:35:29 2011
New Revision: 1066006
URL: http://svn.apache.org/viewvc?rev=1066006&view=rev
Log:
Handle "/./" and "/%2E/" in the same way while canonicalizing urls. Before
this patch the first was handled as a no-op segment, while the second was
handled as a segment containing just a dot.
* subversion/libsvn_subr/dirent_uri.c
(canonicalize): Handle %2E while canonicalizing urls.
* subversion/tests/libsvn_subr/dirent_uri-test.c
(test_uri_canonicalize): Add a few tests on noop segments.
(test_uri_is_canonical): Add two test cases on noop segments.
Modified:
subversion/trunk/subversion/libsvn_subr/dirent_uri.c
subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
Modified: subversion/trunk/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/dirent_uri.c?rev=1066006&r1=1066005&r2=1066006&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Tue Feb 1 11:35:29 2011
@@ -484,6 +484,12 @@ canonicalize(path_type_t type, const cha
{
/* Noop segment, so do nothing. */
}
+ else if (type == type_uri && seglen == 3
+ && src[0] == '%' && src[1] == '2'
+ && canonicalize_to_upper(src[2]) == 'E')
+ {
+ /* '%2E' is equivalent to '.', so this is a noop segment */
+ }
#ifdef SVN_USE_DOS_PATHS
/* If this is the first path segment of a file:// URI and it contains a
windows drive letter, convert the drive letter to upper case. */
Modified: subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1066006&r1=1066005&r2=1066006&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c Tue Feb 1 11:35:29 2011
@@ -825,6 +825,10 @@ test_uri_canonicalize(apr_pool_t *pool)
{ "http://server////", "http://server" },
{ "http://server/file//", "http://server/file" },
{ "http://server//.//f//", "http://server/f" },
+ { "http://server/d/.", "http://server/d" },
+ { "http://server/d/%2E", "http://server/d" },
+ { "http://server/d/./q", "http://server/d/q" },
+ { "http://server/d/%2E/q", "http://server/d/q" },
{ "file:///C%3a/temp", "file:///C:/temp" },
{ "http://server/cr%AB", "http://server/cr%AB" },
{ "http://server/cr%ab", "http://server/cr%AB" },
@@ -1099,6 +1103,8 @@ test_uri_is_canonical(apr_pool_t *pool)
{ "http://hst/foo/../bar", TRUE, TRUE },
{ "http://hst/foo/bar/", FALSE, TRUE },
{ "http://hst/", FALSE, TRUE },
+ { "http://hst/foo/.", FALSE, TRUE },
+ { "http://hst/foo/%2E", FALSE, TRUE },
{ "http://HST", FALSE, TRUE },
{ "http://HST/", FALSE, TRUE },
{ "http://HST/FOO/BaR", FALSE, TRUE },