dreid 2004/06/21 08:50:55 Modified: uri apr_uri.c Log: Commit Nick Kews patch from bug #28450. Some white space adjustments were needed. The bug report should now be closed. Bug Report: 28450 Obtained from: Nick Kew Reviewed by: David Reid Revision Changes Path 1.21 +16 -0 apr-util/uri/apr_uri.c Index: apr_uri.c =================================================================== RCS file: /home/cvs/apr-util/uri/apr_uri.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- apr_uri.c 21 Feb 2004 00:43:56 -0000 1.20 +++ apr_uri.c 21 Jun 2004 15:50:55 -0000 1.21 @@ -273,6 +273,20 @@ * the reason for the gotos. -djg */ if (uri[0] == '/') { + /* RFC2396 #4.3 says that two leading slashes mean we have an + * authority component, not a path! Fixing this looks scary + * with the gotos here. But if the existing logic is valid, + * then presumably a goto pointing to deal_with_authority works. + * + * RFC2396 describes this as resolving an ambiguity. In the + * case of three or more slashes there would seem to be no + * ambiguity, so it is a path after all. + */ + if (uri[1] == '/' && uri[2] != '/') { + s = uri + 2 ; + goto deal_with_authority ; + } + deal_with_path: /* we expect uri to point to first character of path ... remember * that the path could be empty -- http://foobar?query for example @@ -316,6 +330,8 @@ uptr->scheme = apr_pstrmemdup(p, uri, s - uri); s += 3; + +deal_with_authority: hostinfo = s; while ((uri_delims[*(unsigned char *)s] & NOTEND_HOSTINFO) == 0) { ++s;