summaryrefslogtreecommitdiff
path: root/utils/url.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-01-07 12:01:11 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-01-07 12:01:11 +0000
commit2fa8e656a1f42e064266adfe89d9ce3813790dd4 (patch)
treea9ea8c5f5474e20399a8ceaf2aa0e4e16068a5f7 /utils/url.c
parent74078b6e36197946a5f18f48bc363c50cec1a65a (diff)
downloadnetsurf-2fa8e656a1f42e064266adfe89d9ce3813790dd4.tar.gz
netsurf-2fa8e656a1f42e064266adfe89d9ce3813790dd4.tar.bz2
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
Diffstat (limited to 'utils/url.c')
-rw-r--r--utils/url.c11
1 files changed, 2 insertions, 9 deletions
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