kennethreitz/requests — pull request #1919 by zackw (2014-02-13 23:15:34+00:00)
Title: Redirection-related bugfixes.

This pull request contains the subset of #1913 which (IMNSHO) consists entirely of bugfixes, with no question about backward compatibility or what the best behavior should be.

- `Session.resolve_redirects` no longer crashes, when responses are
being loaded in `stream=True` mode, if `Response.iter_content`
is used to consume the entire stream before advancing the generator.
- `Response.history` is now always a list, not a tuple.
- Each response in a chain of redirects now has a filled-out history
property, consisting of all responses up to but not including itself.

And I didn't bother mentioning it in HISTORY.rst, but `Session.send` doesn't create the redirection resolution generator anymore if it's not going to use it, and `resolve_redirects` doesn't extract cookies anymore that `send` has already extracted, both of which should make things ever so slightly more efficient.

Some of the new tests are pretty grody, and raise the question of whether the response-modification hook should really be *allowed* to modify history, but there's specific code in `send` to support them, so this seems to have been a desired feature...