kennethreitz/requests — Issue #458: requests should send "Connection: close" if keep-alive is disabled
Author: craigholm
Created: 2012-02-26 23:17:29+00:00
State: open

From Section 14.10 of RFC2616:

'HTTP/1.1 applications that do not support persistent connections MUST include the "close" connection option in every message.'

If keep-alive is disabled, a session object creates a new connection for each request, but each previous connection isn't closed until the connection times out or the garbage collector takes care of it. This wastes resources on both sides of the connection.

(As an aside, I've noticed that http://httpbin.org/headers returns "Connection: keep-alive" in the headers object even if the client sent "Connection: close").