Preserve scheme, user, host, and port if the redirection doesn't have them
This commit is contained in:
parent
2741356913
commit
23226b41da
|
@ -234,9 +234,19 @@
|
||||||
=>
|
=>
|
||||||
(λ (m)
|
(λ (m)
|
||||||
(define m1 (list-ref m 1))
|
(define m1 (list-ref m 1))
|
||||||
(define url (with-handlers ((exn:fail? (λ (x) #f)))
|
(define next-url
|
||||||
(string->url m1)))
|
(with-handlers ((exn:fail? (λ (x) #f)))
|
||||||
(loop (or url new-url) chunked? (cons line headers)))]
|
(define next-url (string->url m1))
|
||||||
|
(make-url
|
||||||
|
(or (url-scheme next-url) (url-scheme url))
|
||||||
|
(or (url-user next-url) (url-user url))
|
||||||
|
(or (url-host next-url) (url-host url))
|
||||||
|
(or (url-port next-url) (url-port url))
|
||||||
|
(url-path-absolute? next-url)
|
||||||
|
(url-path next-url)
|
||||||
|
(url-query next-url)
|
||||||
|
(url-fragment next-url))))
|
||||||
|
(loop (or next-url new-url) chunked? (cons line headers)))]
|
||||||
[else (loop new-url chunked? (cons line headers))])))
|
[else (loop new-url chunked? (cons line headers))])))
|
||||||
(define redirection-status-line?
|
(define redirection-status-line?
|
||||||
(regexp-match #rx"^HTTP/[0-9]+[.][0-9]+ 3[0-9][0-9]" status))
|
(regexp-match #rx"^HTTP/[0-9]+[.][0-9]+ 3[0-9][0-9]" status))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user