guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] web: Handle ending CRLF (\r\n) for chunked input and out


From: Ludovic Courtès
Subject: Re: [PATCH 1/2] web: Handle ending CRLF (\r\n) for chunked input and output ports.
Date: Mon, 04 Jul 2022 11:54:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)

Hi Chris,

Christopher Baines <mail@cbaines.net> skribis:

> The chunked transfer encoding specifies the chunked body ends with
> CRLF. This is in addition to the CRLF at the end of the last chunk, so
> there should be CRLF twice at the end of the chunked body:
>
>   https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1
>
> * module/web/http.scm (make-chunked-input-port): Read two extra bytes at
> the end of the chunked input.
> (make-chunked-output-port): Write the missing \r\n when closing the
> port.
> * test-suite/tests/web-http.test (chunked encoding): Add missing \r\n to
> test data.

[...]

> This port is of limited use if it cannot be used reliably. Rather than
> behaving as if the input has finished when it ends unexpectedly, instead
> raise an exception.
>
> * module/web/http.scm (make-chunked-input-port): Raise an exception on
> premature termination.
> (&chunked-input-ended-prematurely): New exception type.
> (chunked-input-ended-prematurely-error?): New procedure.
> * test-suite/tests/web-http.test (pass-if-named-exception): Rename to
> pass-if-named-exception.
> (pass-if-named-exception): New syntax.
> ("Exception on premature chunk end"): New test for this behaviour.

Applied, thanks!

Are there servers out there where you would hit this bug?  We were
“lucky” not to notice before I guess.

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]