]> git.ozlabs.org Git - petitboot/commitdiff
lib/url: fix no-scheme URL parsing
authorJeremy Kerr <jk@ozlabs.org>
Thu, 2 May 2013 09:30:55 +0000 (17:30 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 6 May 2013 01:02:12 +0000 (09:02 +0800)
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>

No differences found