guix-patches
[Top][All Lists]
Advanced

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

[bug#48556] [PATCH 0/4] Add keep-alive support to guix publish.


From: Ludovic Courtès
Subject: [bug#48556] [PATCH 0/4] Add keep-alive support to guix publish.
Date: Sat, 29 May 2021 17:32:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Mathieu Othacehe <othacehe@gnu.org> skribis:

> The Guile web server is reading the response connection header to decide
> whether to close the connection. However, as the request connection header is
> not forwarded to the response, this mechanism cannot work.
>
> * guix/scripts/publish.scm (add-extra-headers): New procedure.
> (make-request-handler): Use it to forward the request connection header to the
> response.

[...]

> +(define (add-extra-headers request response)
> +  "Append the REQUEST connection header to the given RESPONSE headers and
> +return them."
> +  (if (pair? response)
> +      `(,@response
> +        ,(assq 'connection (request-headers request)))
> +      response))

How about:

  (define (preserve-connection-header request headers)
    "Add REQUEST's 'connection' header, if any, to HEADERS, a list of
  response headers.
    …)

?

> +  ;; Forward the request connection header to the response, so that the 
> server
> +  ;; can close the connection if this is requested by the client.

I’d write: “Preserve the request's 'connection' header in the response
[…]”.  Quoting “connection” simplifies parsing IMO.

Otherwise LGTM!

Ludo’.





reply via email to

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