SHA256
1
0
forked from pool/guile
guile/revert-http-reader-change.patch
Peter Simons b3b846d79e Accepting request 711885 from home:jbrielmaier:branches:devel:languages:misc
Should build fine on all supported platforms. I did not test it run time wise.

Upstream thinks about making a 2.2.6 release including the revert-http-reader-change.patch, but as it's only one patch, I think we can go with 2.2.5 + patch and update to 2.2.6 when it's released :)

OBS-URL: https://build.opensuse.org/request/show/711885
OBS-URL: https://build.opensuse.org/package/show/devel:languages:misc/guile?expand=0&rev=106
2019-06-30 19:33:07 +00:00

98 lines
3.9 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From e1225d013ed8673382d6d8f9300dd6b175c8b820 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@netris.org>
Date: Mon, 24 Jun 2019 10:24:28 -0400
Subject: Revert "web: Add support for HTTP header continuation lines."
Fixes <https://bugs.gnu.org/36350>.
This reverts commit 73cde5ed7218a090ecee888870908af5445796f0.
---
module/web/http.scm | 31 +++++++------------------------
test-suite/tests/web-http.test | 11 +----------
2 files changed, 8 insertions(+), 34 deletions(-)
diff --git a/module/web/http.scm b/module/web/http.scm
index f1ca733..de61c94 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -1,6 +1,6 @@
;;; HTTP messages
-;; Copyright (C) 2010-2017, 2019 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2017 Free Software Foundation, Inc.
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -152,35 +152,18 @@ The default writer will call put-string."
(lambda (val port)
(put-string port val)))))
-(define spaces-and-tabs
- (char-set #\space #\tab))
-
-(define (space-or-tab? c)
- (case c
- ((#\space #\tab) #t)
- (else #f)))
-
(define (read-header-line port)
- "Read an HTTP header line, including any continuation lines, and
-return the combined string 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."
+ "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.
- (let ((line (if (string-suffix? "\r" line)
- (string-drop-right line 1)
- line)))
- ;; If the next character is a space or tab, then there's at least
- ;; one continuation line. Read the continuation lines by calling
- ;; 'read-header-line' recursively, and append them to this header
- ;; line, folding the leading spaces and tabs to a single space.
- (if (space-or-tab? (lookahead-char port))
- (string-append line " " (string-trim (read-header-line port)
- spaces-and-tabs))
- line)))
+ (if (string-suffix? "\r" line)
+ (string-drop-right line 1)
+ line))
((line . _) ;EOF or missing delimiter
(bad-header 'read-header-line line))))
diff --git a/test-suite/tests/web-http.test b/test-suite/tests/web-http.test
index c1cf088..6337734 100644
--- a/test-suite/tests/web-http.test
+++ b/test-suite/tests/web-http.test
@@ -1,6 +1,6 @@
;;;; web-http.test --- HTTP library -*- mode: scheme; coding: utf-8; -*-
;;;;
-;;;; Copyright (C) 2010-2011, 2014-2017, 2019 Free Software Foundation, Inc.
+;;;; Copyright (C) 2010-2011, 2014-2017 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -242,15 +242,6 @@
(pass-if-round-trip "Cache-Control: acme-cache-extension=100 quux\r\n")
(pass-if-round-trip "Cache-Control: acme-cache-extension=\"100, quux\"\r\n")
- (let ((str "Cache-Control: acme-cache-extension=\"100,\r\n\t foo,\r\n quux\"\r\n")
- (val '(cache-control . ((acme-cache-extension . "100, foo, quux")))))
- (pass-if-equal "continuation lines"
- val
- (call-with-values (lambda ()
- (read-header (open-input-string str)))
- (lambda (sym val)
- (cons sym val)))))
-
(pass-if-parse connection "close" '(close))
(pass-if-parse connection "Content-Encoding" '(content-encoding))
--
cgit v1.0-41-gc330