aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-26 13:49:07 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-26 13:49:07 +0100
commit3ee79ba7b683275ef066f4d61b1ce50b64bd19ac (patch)
tree22c70454755561c46e3297ff5c91b131d546a893 /guix-build-coordinator/agent-messaging
parentad2337f9873ff6767211a0ff657d96e6b0951838 (diff)
downloadbuild-coordinator-3ee79ba7b683275ef066f4d61b1ce50b64bd19ac.tar
build-coordinator-3ee79ba7b683275ef066f4d61b1ce50b64bd19ac.tar.gz
Try to fix handling of chuncked requests
From looking at what curl does, it seems that the last the requests end in "0\r\n\r\n". The requests being sent before just had "0\r\n" at the end. This worked with the server, because that wasn't expecting the final "\r\n", and it would crash if it was included, as it would be read as the start of the next request. To work around this, adjust both the sending and receiving of the requests. Send the "\r\n" after the chuncked data when making requests, and use a patched version of make-chunked-input-port that requests two more bytes after it's finished reading the last chunk.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm6
1 files changed, 3 insertions, 3 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index a561b18..75689c2 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -56,9 +56,9 @@
if there was no request body."
(cond
((member '(chunked) (request-transfer-encoding r))
- (make-chunked-input-port (request-port r)
- ;; closing the port is handled elsewhere
- #:keep-alive? #t))
+ (make-chunked-input-port* (request-port r)
+ ;; closing the port is handled elsewhere
+ #:keep-alive? #t))
(else
(let ((nbytes (request-content-length r)))
(and nbytes