We were incorrectly dropping the first strlen("file://") characters from
URLs with no scheme:
--- test/urls/data/localpath.test 2013-05-02 17:26:48.
826359036 +0800
+++ /tmp/tmp.gn4JsWLw5o 2013-05-02 17:26:50.
262364613 +0800
@@ -2,6 +2,6 @@
scheme file
host (null)
port (null)
-path /test/path/to/local/file
-dir /test/path/to/local/
+path ath/to/local/file
+dir ath/to/local/
file file
This change fixes the issue by indicating "no scheme found" by a NULL
return from pb_url_find_scheme, and hadling it appropriately. We add a
testcase too.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
- /* Assume this is a non-url local file. */
-
- return file_scheme;
}
static void pb_url_parse_path(struct pb_url *url)
}
static void pb_url_parse_path(struct pb_url *url)
return NULL;
si = pb_url_find_scheme(url_str);
return NULL;
si = pb_url_find_scheme(url_str);
-
- url->scheme = si->scheme;
- p = url_str + si->str_len + strlen("://");
+ if (si) {
+ url->scheme = si->scheme;
+ p = url_str + si->str_len + strlen("://");
+ } else {
+ url->scheme = file_scheme->scheme;
+ p = url_str;
+ }
url->full = talloc_strdup(url, url_str);
url->full = talloc_strdup(url, url_str);
data/http-simple.test \
data/join-full.test \
data/join-absolute.test \
data/http-simple.test \
data/join-full.test \
data/join-absolute.test \
- data/join-relative.test
+ data/join-relative.test \
+ data/localpath.test
TEST_EXTENSIONS = .test
TEST_LOG_COMPILER = $(builddir)/run-url-test
TEST_EXTENSIONS = .test
TEST_LOG_COMPILER = $(builddir)/run-url-test
--- /dev/null
+/test/path/to/local/file
+scheme file
+host (null)
+port (null)
+path /test/path/to/local/file
+dir /test/path/to/local/
+file file