From 2fa8e656a1f42e064266adfe89d9ce3813790dd4 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 7 Jan 2008 12:01:11 +0000 Subject: The previous fix was broken -- URI paths include the leafname. Make url_path() return the full path (including the leafname). Defaulted cookie path attributes have the leafname and trailing slash stripped. Add testcase for defaulted path. Fix testcase conditions for paths with leafnames. svn path=/trunk/netsurf/; revision=3693 --- utils/url.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'utils/url.c') diff --git a/utils/url.c b/utils/url.c index aaf82cd62..3a43e1765 100644 --- a/utils/url.c +++ b/utils/url.c @@ -668,7 +668,6 @@ url_func_result url_path(const char *url, char **result) { url_func_result status; struct url_components components; - int len; assert(url); @@ -677,15 +676,9 @@ url_func_result url_path(const char *url, char **result) if (!components.path) { status = URL_FUNC_FAILED; } else { - len = strlen(components.path); - while (components.path[len - 1] != '/') - len--; - *result = malloc(len + 2); + *result = strdup(components.path); if (!(*result)) status = URL_FUNC_NOMEM; - else - snprintf((*result), len + 1, "%s", - components.path); } } url_destroy_components(&components); @@ -693,7 +686,7 @@ url_func_result url_path(const char *url, char **result) } /** - * Extract leafname segment from an URL + * Extract leafname from an URL * * \param url an absolute URL * \param result pointer to pointer to buffer to hold result -- cgit v1.2.3