Fixing bug in uri path parsing.

This commit is contained in:
Alex Shinn 2013-08-18 17:09:39 +09:00
parent e464f30ba2
commit a1e22d42d4
2 changed files with 14 additions and 5 deletions

View file

@ -94,11 +94,11 @@
(end (string-cursor-end str)) (end (string-cursor-end str))
(colon0 (string-find str #\:)) (colon0 (string-find str #\:))
(colon (colon
(and (string-cursor>=? (if (string-cursor>=?
(string-find str char-uri-scheme-unsafe? start colon0) (string-find str char-uri-scheme-unsafe? start colon0)
colon0) colon0)
(string-cursor<? colon0 end) colon0
colon0))) end)))
(if (string-cursor>=? colon end) (if (string-cursor>=? colon end)
(and scheme (and scheme
(let* ((quest (string-find str #\?)) (let* ((quest (string-find str #\?))

View file

@ -53,4 +53,13 @@
(test '(("a" . "1") ("b" . "2 2") ("c" . "3")) (test '(("a" . "1") ("b" . "2 2") ("c" . "3"))
(uri-query (string->uri "http://google.com/%73?a=1&b=2+2;c=%33" #t #t))) (uri-query (string->uri "http://google.com/%73?a=1&b=2+2;c=%33" #t #t)))
(let ((str "/"))
(test-assert (uri? (string->path-uri 'http str)))
(test 'http (uri-scheme (string->path-uri 'http str)))
(test #f (uri-host (string->path-uri 'http str)))
(test #f (uri-port (string->path-uri 'http str)))
(test "/" (uri-path (string->path-uri 'http str)))
(test #f (uri-query (string->path-uri 'http str)))
(test #f (uri-fragment (string->path-uri 'http str))))
(test-end) (test-end)