Subject: Re: bug#13095: http-get: Throw to key `bad-response' with args `("EOF while reading response body: ...)'

From: Ian Price <[email-masked]>
Date: Sat, 08 Dec 2012 20:47:49 +0000

Okay so, chunked encoding was a red herring on my part. I saw the
#<input: r6rs-custom-binary-input-p…> and jumped to conclusions. The
actual port created was a "delimited port", which tries to read the
appropriate amount of bytes according to the content-length
header.

Now, the problem, as I see it, is that when http-get (and http-get*) is
called without the #:keep-alive? #t option, it will call (shutdown port
1)[0], which is to close the port for any outgoing traffic. This sounds
fine in theory, but I think (I am no networking expert), that it is also
preventing any requests for additional data.

I do notice that it works correctly when I remove the calls to shutdown,
which gives me confidence that it is the culprit, even if that analysis
is not entirely correct (and I'm not sure it is)

Removing the calls to shutdown should be fine, since when keep-alive? is
#f, we close the ports after the read anyway.

I'm going to withhold pushing a patch and closing this bug for the
moment, until I'm satisfied of the reason why this is the problem.

0. I have checked that 1 corresponds to SHUT_WR on my platform
-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"