diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-06-27 23:33:48 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-06-27 23:33:48 +0200 |
commit | 5cc1075a76392666d3d733837f5c6252b1e48002 (patch) | |
tree | aff2a303881a6fe53021a6e78a767958e608719b /guix/scripts/publish.scm | |
parent | 9c2563a80b6f1d8fb8677f5314e6180ea9916aa5 (diff) | |
parent | c30d117822a8ca26cd8c06c0a3974955bef68eac (diff) | |
download | guix-patches-5cc1075a76392666d3d733837f5c6252b1e48002.tar guix-patches-5cc1075a76392666d3d733837f5c6252b1e48002.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/scripts/publish.scm')
-rw-r--r-- | guix/scripts/publish.scm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index b4334b3f16..c716998a5b 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -724,6 +724,32 @@ example: \"/foo/bar\" yields '(\"foo\" \"bar\")." (define %http-write (@@ (web server http) http-write)) +(match (list (major-version) (minor-version) (micro-version)) + (("2" "2" "5") ;Guile 2.2.5 + (let () + (define %read-line (@ (ice-9 rdelim) %read-line)) + (define bad-header (@@ (web http) bad-header)) + + ;; XXX: Work around <https://bugs.gnu.org/36350> by reverting to the + ;; definition of 'read-header-line' as found in 2.2.4 and earlier. + (define (read-header-line port) + "Read an HTTP header line and return it without its final CRLF or LF. +Raise a 'bad-header' exception if the line does not end in CRLF or LF, +or if EOF is reached." + (match (%read-line port) + (((? string? line) . #\newline) + ;; '%read-line' does not consider #\return a delimiter; so if it's + ;; there, remove it. We are more tolerant than the RFC in that we + ;; tolerate LF-only endings. + (if (string-suffix? "\r" line) + (string-drop-right line 1) + line)) + ((line . _) ;EOF or missing delimiter + (bad-header 'read-header-line line)))) + + (set! (@@ (web http) read-header-line) read-header-line))) + (_ #t)) + (define (strip-headers response) "Return RESPONSE's headers minus 'Content-Length' and our internal headers." (fold alist-delete |