Fix error with URL-parsing
Query parameters (post-?) were previously ignored.
This commit is contained in:
parent
28f40c5f6e
commit
d9bead00b4
|
@ -139,7 +139,7 @@ already set)."
|
||||||
(defun http-fetch (url path)
|
(defun http-fetch (url path)
|
||||||
"Download a URL to a path; if successful, returns the pathname. Otherwise, NIL."
|
"Download a URL to a path; if successful, returns the pathname. Otherwise, NIL."
|
||||||
(handler-case
|
(handler-case
|
||||||
(and (dexador:fetch (url-encode-uri (quri:uri url)) path)
|
(and (dexador:fetch (url-encode-uri url) path)
|
||||||
(pathname path))
|
(pathname path))
|
||||||
(cl-user::file-exists ()
|
(cl-user::file-exists ()
|
||||||
path)
|
path)
|
||||||
|
@ -154,7 +154,7 @@ already set)."
|
||||||
(quri:uri-scheme uri)
|
(quri:uri-scheme uri)
|
||||||
(quri:uri-host uri)
|
(quri:uri-host uri)
|
||||||
(uri-explicit-port uri)
|
(uri-explicit-port uri)
|
||||||
(url-encode-path (quri:uri-path uri)))))
|
(url-encode-path (uri-path+query uri)))))
|
||||||
|
|
||||||
;; string → string
|
;; string → string
|
||||||
(defun url-encode-path (path)
|
(defun url-encode-path (path)
|
||||||
|
@ -178,3 +178,8 @@ That is, 443 is implied by HTTPS, so nil is returned; but 998 wouldn’t be impl
|
||||||
(and (equal scheme "http")
|
(and (equal scheme "http")
|
||||||
(eq port 80)))
|
(eq port 80)))
|
||||||
port)))
|
port)))
|
||||||
|
|
||||||
|
;; quri-uri → string
|
||||||
|
(defun uri-path+query (uri)
|
||||||
|
"Return everything in a URI after the TLD — that is, both the path _and_ the query."
|
||||||
|
(format nil "~A~@[?~A~]" (quri:uri-path uri) (quri:uri-query uri)))
|
||||||
|
|
Ŝarĝante…
Reference in New Issue