From 7338f3ce8846fb6a78e8691e79a8c83474a6ac9a Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 27 Mar 2017 18:09:29 +0100 Subject: nsurl: Remove redundant code path. --- utils/nsurl/parse.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'utils') diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c index 7e7873200..7474a612d 100644 --- a/utils/nsurl/parse.c +++ b/utils/nsurl/parse.c @@ -1430,14 +1430,15 @@ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined) struct url_markers m_path; size_t new_length; - if (base->components.host != NULL && - base->components.path == NULL) { - /* Append relative path to "/". */ - *(buff_pos++) = '/'; - memcpy(buff_pos, rel + m.path, m.query - m.path); - buff_pos += m.query - m.path; - - } else { + /* RFC3986 said to append relative path to "/" if the + * base path had no path and an authority. + * + * However, that specification is redundant, and base paths + * are normalised, so file, http, and https URLs will always + * have a non-empty path. (Empty paths become "/".) + */ + + { /* Append relative path to all but last segment of * base path. */ size_t path_end = lwc_string_length( -- cgit v1.2.3