Better connection behaviour for chunked upload.
PEP8 fix to make me happier.
Merge pull request #1669 from Lukasa/chunked

[WIP] Better chunked handling.