Based on the python source for `http.client`, `HTTPConnection.putheader`
can only be called after a request has been started, and before it's
been sent. Otherwise it will throw a `http.client.CannotSendHeader`
exception.
If the server returns a `Set-Cookie` header, the client will always
fail with the `CannotSendHeader` exception because `HTTPConnection.putheader`
is called after reading the response.
With this patch we will call this method before the request has been sent.