While looking at some debug output from Wget, I noticed that in case of a 416 Range Not Satisfiable response, Wget forces the connection close despite the fact that the server explicitly sent a `Connection: Keep-Alive` header.

Looking at the code, I found this at http.c:2775


     CLOSE_INVALIDATE (sock);        /* would be CLOSE_FINISH, but there
                                  might be more bytes in the body. */

I'm not sure what exactly we're trying to protect in this case. Why is CLOSE_INVALIDATE required instead of CLOSE_FINISH? If the server responds with a 416 status, there should be no more data in the stream and we should be able to
reuse that connection without any issues.

What am I missing here?


I wanted to write a test case to demonstrate this, but detecting a closed socket will take more than a quick test case. I'll sit down and write the required functionality to generate the relevant test case when I can.

--
Thanking You,
Darshit Shah

Attachment: pgpEvplxaxZsg.pgp
Description: PGP signature

Reply via email to