Sync with recent Requests commits. Fixes #1796