If a webserver doesn't implement keep-alive (e.g. httpd-shed as currently used in the test harness), HTTP doesn't notice and still tries to send a second request on the same connection.
I'm getting a similar error, but instead of throwing ErrorReset or ErrorClosed, we just get the underlying socket error.
The client has sent a PUT request to the server. Here's the client log from the point where we get the response, and then try to send the next PUT request:
HTTP/1.1 204 No Content
Date: Fri, 28 Sep 2012 15:59:57 GMT
PUT /user/foobar HTTP/1.1
Debug: Recovering connection to admin:admin@localhost:8080
hackage-import: <socket: 4>: resource vanished
The important thing to notice here is that the server is responding with Connection: close (and presumably then does actually close the socket).
BTW, that's with HTTP-4000.2.5
This issue also seems to be the cause of bug in cabal-install which crashes (for me) when using a proxy.
Fix #14: connection pool tries to reuse closed connections
If a reply contains a "Connection: close" header, the connection is
closed and removed from the connection pool. This fixes the problem
where HTTP tried to reuse connections that had been closed at the
server end, leading to "broken pipe" errors.