publish: Add keep-alive support when sending nar.
authorMathieu Othacehe <othacehe@gnu.org>
Thu, 20 May 2021 08:42:56 +0000 (10:42 +0200)
committerMathieu Othacehe <othacehe@gnu.org>
Tue, 1 Jun 2021 07:10:32 +0000 (09:10 +0200)
commit0b8fa24bbd3576a8b20f27930e9a6b296e6b6068
tree6a5f3d978fd6f4fa957912695e724e5d044d5219
parent2acc114a963e91852ce517e763272528e4ba99a0
publish: Add keep-alive support when sending nar.

The default Guile web server implementation supports the keep alive
mechanism. However, in our custom http-write implementation, the connection
is unconditionally close after sending nar files.

To prevent that, when supported, add the client port to the server poll set so
that further requests can be handled without closing the connection.

* guix/scripts/publish.scm (nar-response-port): Rename it into ...
(nar-compressed-port): ... this procedure. Operate directly on a given PORT.
(http-write): Add keep-alive support when sending nar files.
* guix/scripts/substitute.scm (process-substitution): Pass the download size
to the progress-report-port procedure so that it doesn't block reading from
the input port when keep-alive is supported.
guix/scripts/publish.scm
guix/scripts/substitute.scm