-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Julian Foad wrote:
[..]
> In the second place it is used, we know it holds a URL:
>
>> case ELEM_href:
>> /* Special handling for <href> that belongs to the <response> tag. */
>> if (rsrc->href_parent == ELEM_response)
>> return assign_rsrc_url(pc->rsrc, cdata, pc->pool);
>
> That's where we can canonicalize it. And are there any other places
> where the "cdata" variable is known to hold a URL? I'm looking... No,
> there are no others. In all the rest of the places, it is providing a
> generic "property value".
>
> With that fix, I believe the patch will be correct.
Thank you for the comments, Julian. I thought it's better to
canonicalize in the first place, but should be otherwise! Attaching the
updated patch as per your feedback, herewith.
[[[
Log:
Ensure the URLs in libsvn_ra_neon are always canonical.
[ in subversion/libsvn_ra_neon ]
* ra_neon.h
(svn_ra_neon__request_get_location): Update doc string to reflect that
it returns a canonicalized URL.
* util.c
(svn_ra_neon__request_get_location): Canonicalize the 'BASE URL' as
per the rule.
* props.c
(end_element): Same.
* options.c
(end_element): Same.
Found by: stsp
Suggested by: stsp, julianfoad
Patch by: Kannan R <[email protected]>
]]]
- --
Thanks & Regards,
Kannan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEVAwUBS1hA93lTqcY7ytmIAQIKLgf+P5n39GaVhl53zJ4oaEQOVMMX0ovSerqQ
Taakt6wLMuQREhnCoLzivk8phn3zyFXRV4wiqFly94X2wKFcKCX/K3I4nheecM5W
j/+DPQo4MLnFZDh8eJXuI4RpCR6+iP5Vz0wciE2nsVYt3+EJFGtqm+ZQTkgmj2iX
QnuVe55/GfNjIcsrqmJnjhwJ8W/YbKeBUq2iueeUPcC0m6T60WfK6Fy/3aEVVCYn
W/7TshgnFClyLdfAXDF8byrf5+fYDRjH49LBv7IMcd8A4krALCZ4+whYIIQNS2A7
byBGrTdViBtWr5vOO0POQEWwYMX8J9pLc5dNP/3LlzaM8CGReXb2AA==
=Fqzw
-----END PGP SIGNATURE-----
Index: subversion/libsvn_ra_neon/ra_neon.h
===================================================================
--- subversion/libsvn_ra_neon/ra_neon.h (revision 901660)
+++ subversion/libsvn_ra_neon/ra_neon.h (working copy)
@@ -973,6 +973,7 @@
apr_pool_t *pool);
/* Return the Location HTTP header or NULL if none was sent.
+ * (Return a canonical URL even if the header ended with a slash.)
*
* Do allocations in POOL.
*/
Index: subversion/libsvn_ra_neon/util.c
===================================================================
--- subversion/libsvn_ra_neon/util.c (revision 901660)
+++ subversion/libsvn_ra_neon/util.c (working copy)
@@ -1490,5 +1490,5 @@
apr_pool_t *pool)
{
const char *val = ne_get_response_header(request->ne_req, "Location");
- return val ? apr_pstrdup(pool, val) : NULL;
+ return val ? svn_uri_canonicalize(val, pool) : NULL;
}
Index: subversion/libsvn_ra_neon/options.c
===================================================================
--- subversion/libsvn_ra_neon/options.c (revision 901660)
+++ subversion/libsvn_ra_neon/options.c (working copy)
@@ -107,7 +107,9 @@
options_ctx_t *oc = baton;
if (state == ELEM_href)
- oc->activity_coll = svn_string_create_from_buf(oc->cdata, oc->pool);
+ oc->activity_coll = svn_string_create(svn_uri_canonicalize(oc->cdata->data,
+ oc->pool),
+ oc->pool);
return SVN_NO_ERROR;
}
Index: subversion/libsvn_ra_neon/props.c
===================================================================
--- subversion/libsvn_ra_neon/props.c (revision 901660)
+++ subversion/libsvn_ra_neon/props.c (working copy)
@@ -413,7 +413,8 @@
case ELEM_href:
/* Special handling for <href> that belongs to the <response> tag. */
if (rsrc->href_parent == ELEM_response)
- return assign_rsrc_url(pc->rsrc, cdata, pc->pool);
+ return assign_rsrc_url(pc->rsrc, svn_uri_canonicalize(cdata, pc->pool),
+ pc->pool);
/* Use the parent element's name, not the href. */
parent_defn = defn_from_id(rsrc->href_parent);