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 2013/03/07 20:40:35 UTC
svn commit: r1454047 - in /subversion/trunk/subversion:
libsvn_subr/dirent_uri.c tests/libsvn_subr/dirent_uri-test.c
Author: rhuijben
Date: Thu Mar 7 19:40:35 2013
New Revision: 1454047
URL: http://svn.apache.org/r1454047
Log:
Allow ipv6 addresses encoded in urls in the common
http://[::1]/svn/repos format.
by extending our canonical urls a tiny bit.
* subversion/libsvn_subr/dirent_uri.c
(canonicalize,
svn_uri_is_canonical): Allow lower case [] ipv6 addresses.
* subversion/tests/libsvn_subr/dirent_uri-test.c
(uri_canonical_tests): Add a few ipv6 testcases.
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=1454047&r1=1454046&r2=1454047&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/trunk/subversion/libsvn_subr/dirent_uri.c Thu Mar 7 19:40:35 2013
@@ -359,8 +359,24 @@ canonicalize(path_type_t type, const cha
src = seg;
/* Found a hostname, convert to lowercase and copy to dst. */
- while (*src && (*src != '/') && (*src != ':'))
- *(dst++) = canonicalize_to_lower((*src++));
+ if (*src == '[')
+ {
+ *(dst++) = *(src++); /* Copy '[' */
+
+ while (*src == ':'
+ || (*src >= '0' && (*src <= '9'))
+ || (*src >= 'a' && (*src <= 'f'))
+ || (*src >= 'A' && (*src <= 'F')))
+ {
+ *(dst++) = canonicalize_to_lower((*src++));
+ }
+
+ if (*src == ']')
+ *(dst++) = *(src++); /* Copy ']' */
+ }
+ else
+ while (*src && (*src != '/') && (*src != ':'))
+ *(dst++) = canonicalize_to_lower((*src++));
if (*src == ':')
{
@@ -1774,12 +1790,28 @@ svn_uri_is_canonical(const char *uri, ap
/* Found a hostname, check that it's all lowercase. */
ptr = seg;
- while (*ptr && *ptr != '/' && *ptr != ':')
+
+ if (*ptr == '[')
{
- if (*ptr >= 'A' && *ptr <= 'Z')
+ ptr++;
+ while (*ptr == ':'
+ || (*ptr >= '0' && *ptr <= '9')
+ || (*ptr >= 'a' && *ptr <= 'f'))
+ {
+ ptr++;
+ }
+
+ if (*ptr != ']')
return FALSE;
ptr++;
}
+ else
+ while (*ptr && *ptr != '/' && *ptr != ':')
+ {
+ if (*ptr >= 'A' && *ptr <= 'Z')
+ return FALSE;
+ ptr++;
+ }
/* Found a portnumber */
if (*ptr == ':')
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=1454047&r1=1454046&r2=1454047&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/dirent_uri-test.c Thu Mar 7 19:40:35 2013
@@ -892,6 +892,14 @@ static const testcase_canonicalize_t uri
{ "file:///C%7C/temp/REPOS", "file:///C%7C/temp/REPOS" },
{ "file:///C|/temp/REPOS", "file:///C%7C/temp/REPOS" },
{ "file:///C:/", "file:///C:" },
+ { "http://[::1]/", "http://[::1]" },
+ { "http://[::1]:80/", "http://[::1]" },
+ { "https://[::1]:443", "https://[::1]" },
+ { "http://[::1]/", "http://[::1]" },
+ { "http://[::1]:80/", "http://[::1]" },
+ { "https://[::1]:443", "https://[::1]" },
+ { "http://[FACE:B00C::]/s","http://[face:b00c::]/s" },
+ { "svn+ssh://b@[1:2::3]/s","svn+ssh://b@[1:2::3]/s" },
#ifdef SVN_USE_DOS_PATHS
{ "file:///c:/temp/repos", "file:///C:/temp/repos" },
{ "file:///c:/temp/REPOS", "file:///C:/temp/REPOS" },