Fix URL-encoding issue with port-numbers
:80 and :443 would be redundantly added to HTTP and HTTPS URLs, respectively.
This commit is contained in:
parent
36c8b2a87b
commit
0a26e42b6f
|
@ -153,7 +153,7 @@ already set)."
|
||||||
(format nil "~@[~A://~]~A~@[:~A~]~A"
|
(format nil "~@[~A://~]~A~@[:~A~]~A"
|
||||||
(quri:uri-scheme uri)
|
(quri:uri-scheme uri)
|
||||||
(quri:uri-host uri)
|
(quri:uri-host uri)
|
||||||
(quri:uri-port uri)
|
(uri-explicit-port uri)
|
||||||
(url-encode-path (quri:uri-path uri)))))
|
(url-encode-path (quri:uri-path uri)))))
|
||||||
|
|
||||||
;; string → string
|
;; string → string
|
||||||
|
@ -166,3 +166,15 @@ already set)."
|
||||||
(lambda (a b)
|
(lambda (a b)
|
||||||
(format nil "~A/~A" a b))
|
(format nil "~A/~A" a b))
|
||||||
(mapcar #'quri:url-encode path-parts))))
|
(mapcar #'quri:url-encode path-parts))))
|
||||||
|
|
||||||
|
;; quri-uri → number
|
||||||
|
(defun uri-explicit-port (uri)
|
||||||
|
"Given a HTTP/HTTPS URI, return a port-number if it isn’t implied by the protocol.
|
||||||
|
That is, 443 is implied by HTTPS, so nil is returned; but 998 wouldn’t be implied."
|
||||||
|
(let ((scheme (quri:uri-scheme uri))
|
||||||
|
(port (quri:uri-port uri)))
|
||||||
|
(unless (or (and (equal scheme "https")
|
||||||
|
(eq port 443))
|
||||||
|
(and (equal scheme "http")
|
||||||
|
(eq port 80)))
|
||||||
|
port)))
|
||||||
|
|
Ŝarĝante…
Reference in New Issue