1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Modify http header parser to use new read-line "\r\n" handling

* module/web/http.scm (read-header-line): modify for new read-line
This commit is contained in:
Michael Gran 2023-06-25 08:21:28 -07:00
parent 9bb8793a6c
commit 993ac2fd74

View file

@ -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))))