Adding option of following redirects (bug 55310)

Update from compat Ie84aa0292270f8a45c0e104a61e037b869f40850

- pep8 changes
- code improvements
- synchronize with compat

Change-Id: Ic862b8653c07e863b89de09c230de0dea31a50ee
Merge "Adding option of following redirects (bug 55310)"