mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Allow relative path in HTTP Location header


From: Sam Lee
Subject: Allow relative path in HTTP Location header
Date: Sun, 1 May 2022 11:31:25 +0000

RFC 7231, published in June 2014, permits relative URIs in Location
headers [1]. The patch below adds support for relative path in HTTP
Location headers.

  [1]: https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2


diff --git a/src/runtime/http-syntax.scm b/src/runtime/http-syntax.scm
index 129c7a44a..43cd61840 100644
--- a/src/runtime/http-syntax.scm
+++ b/src/runtime/http-syntax.scm
@@ -1342,8 +1342,13 @@ USA.
   write-entity-tag)

 (define-header "Location"
-  (direct-parser parse-absolute-uri)
-  absolute-uri?
+  (direct-parser
+   (*parser
+    (alt parse-absolute-uri
+         parse-relative-uri)))
+  (lambda (value)
+    (and (uri? value)
+         (not (uri-fragment value))))
   write-ascii-uri)
 #;
 (define-header "Proxy-Authenticate"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]