From 993ac2fd74025cfe94dcdadf24d42ae98e4eb9a3 Mon Sep 17 00:00:00 2001 From: Michael Gran Date: Sun, 25 Jun 2023 08:21:28 -0700 Subject: [PATCH] Modify http header parser to use new read-line "\r\n" handling * module/web/http.scm (read-header-line): modify for new read-line --- module/web/http.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/module/web/http.scm b/module/web/http.scm index b65fa91c1..4391c9aaa 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -157,13 +157,12 @@ The default writer will call ‘put-string’." 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) . "\r\n") + line) (((? 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)) + ;; We are more tolerant than the RFC in that we tolerate LF-only + ;; endings. + line) ((line . _) ;EOF or missing delimiter (bad-header 'read-header-line line))))