unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Christopher Baines <mail@cbaines.net>
Cc: guile-devel@gnu.org
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	[thread overview]
Message-ID: <87o7y5fbjg.fsf@gnu.org> (raw)
In-Reply-To: <20220630181554.25772-1-mail@cbaines.net> (Christopher Baines's message of "Thu, 30 Jun 2022 19:15:53 +0100")

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’.



  parent reply	other threads:[~2022-07-04  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 18:15 [PATCH 1/2] web: Handle ending CRLF (\r\n) for chunked input and output ports Christopher Baines
2022-06-30 18:15 ` [PATCH 2/2] web: Don't hide missing data in the chunked input port Christopher Baines
2022-07-04  9:54 ` Ludovic Courtès [this message]
2022-07-04 11:37   ` [PATCH 1/2] web: Handle ending CRLF (\r\n) for chunked input and output ports Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7y5fbjg.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    --cc=mail@cbaines.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).