[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12827: [2.0.6] web client: fails to parse 404 header
From: |
Ludovic Courtès |
Subject: |
bug#12827: [2.0.6] web client: fails to parse 404 header |
Date: |
Mon, 26 Nov 2012 01:15:52 +0100 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) |
Hi!
Daniel Hartwig <address@hidden> 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’.
- bug#12827: [2.0.6] web client: fails to parse 404 header, (continued)
- bug#12827: [2.0.6] web client: fails to parse 404 header, Daniel Hartwig, 2012/11/08
- bug#12827: [2.0.6] web client: fails to parse 404 header, Ludovic Courtès, 2012/11/23
- bug#12827: [2.0.6] web client: fails to parse 404 header, Daniel Hartwig, 2012/11/24
- bug#12827: [2.0.6] web client: fails to parse 404 header, Ludovic Courtès, 2012/11/24
- bug#12827: [2.0.6] web client: fails to parse 404 header, Daniel Hartwig, 2012/11/24
- bug#12827: [2.0.6] web client: fails to parse 404 header,
Ludovic Courtès <=
- bug#12827: [2.0.6] web client: fails to parse 404 header, Ludovic Courtès, 2012/11/26
- bug#12827: [2.0.6] web client: fails to parse 404 header, Daniel Hartwig, 2012/11/26
- bug#12827: [2.0.6] web client: fails to parse 404 header, Ludovic Courtès, 2012/11/27
- bug#12827: [2.0.6] web client: fails to parse 404 header, Daniel Hartwig, 2012/11/27
- bug#12827: [2.0.6] web client: fails to parse 404 header, Ludovic Courtès, 2012/11/27