Hi! Daniel Hartwig <mand...@gmail.com> skribis:
> The API seems less clean, and it is not immediately clear > that uri? is not the top of the URI-like type hierarchy. The other > functions only indicate “uri” in their name. I did not > wish to introduce parallel “build-uri-reference”, etc. for each of > these, and did consider adding #:reference? on some to select > weaker validation. OK. So for now, I’d go with this patch, which fixes the bug at hand:
diff --git a/module/web/http.scm b/module/web/http.scm index 342f435..65ebe7d 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -1185,6 +1185,17 @@ treated specially, and is just returned as a plain string." uri? write-uri)) +;; emacs: (put 'declare-relative-uri-header! 'scheme-indent-function 1) +(define (declare-relative-uri-header! name) + (declare-header! name + (lambda (str) + (or (string->uri str) ; absolute URI + (build-uri #f ; relative URI + #:path str + #:validate? #f))) + uri? + write-uri)) + ;; emacs: (put 'declare-quality-list-header! 'scheme-indent-function 1) (define (declare-quality-list-header! name) (declare-header! name @@ -1437,7 +1448,7 @@ treated specially, and is just returned as a plain string." ;; Content-Location = ( absoluteURI | relativeURI ) ;; -(declare-uri-header! "Content-Location") +(declare-relative-uri-header! "Content-Location") ;; Content-MD5 = <base64 of 128 bit MD5 digest as per RFC 1864> ;; @@ -1726,7 +1737,7 @@ treated specially, and is just returned as a plain string." ;; Referer = ( absoluteURI | relativeURI ) ;; -(declare-uri-header! "Referer") +(declare-relative-uri-header! "Referer") ;; TE = #( t-codings ) ;; t-codings = "trailers" | ( transfer-extension [ accept-params ] )
Once 2.0.7 is out, when you have more time, we can fix it cleanly. How does that sound? Thanks, Ludo’.