diff --git a/collects/net/url.rkt b/collects/net/url.rkt index d8042d997a..333784185a 100644 --- a/collects/net/url.rkt +++ b/collects/net/url.rkt @@ -234,9 +234,19 @@ => (λ (m) (define m1 (list-ref m 1)) - (define url (with-handlers ((exn:fail? (λ (x) #f))) - (string->url m1))) - (loop (or url new-url) chunked? (cons line headers)))] + (define next-url + (with-handlers ((exn:fail? (λ (x) #f))) + (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))]))) (define redirection-status-line? (regexp-match #rx"^HTTP/[0-9]+[.][0-9]+ 3[0-9][0-9]" status))