Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Connection reused after premature HTTP server close #5884
On upgrading a project using libcurl from version 7.44.0 to 7.72.0, I encountered a regression in the handling of a premature HTTP server close. The dead connection was correctly discarded in 7.44.0, but incorrectly re-used for a subsequent HTTP request in 7.72.0.
Full details follow with trace output and a tentative fix...
The client starts an HTTP PUT:
The test server says go ahead:
The client starts sending data, but in this test as soon as the test server receives the first bytes of data it deliberately does a
The client then makes a new request to the server.
However, in un-patched 7.7.20 the connection is reused and the new request fails with EPIPE:
After comparing the code flow between the 2 versions of curl, I deduced that the problem was probably introduced by this commit:
That commit changes
I don't know if this is the correct fix for 7.72.0, but I restored the previous behaviour by restoring the