From a8f70e4bb930253065a0596a3b1f4d7894b074a9 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 2 May 2013 17:30:55 +0800 Subject: lib/url: fix no-scheme URL parsing 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 --- test/urls/Makefile.am | 3 ++- test/urls/data/localpath.test | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/urls/data/localpath.test (limited to 'test') diff --git a/test/urls/Makefile.am b/test/urls/Makefile.am index 2163018..da6fcbf 100644 --- a/test/urls/Makefile.am +++ b/test/urls/Makefile.am @@ -33,7 +33,8 @@ TESTS = data/double-slash.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 diff --git a/test/urls/data/localpath.test b/test/urls/data/localpath.test new file mode 100644 index 0000000..ffced1a --- /dev/null +++ b/test/urls/data/localpath.test @@ -0,0 +1,7 @@ +/test/path/to/local/file +scheme file +host (null) +port (null) +path /test/path/to/local/file +dir /test/path/to/local/ +file file -- cgit v1.2.1