Split the request-specific code from HttpConnection.

Also added a number of comments to clarify the logic.

The reason for the split is that I'm going to need a few more things from HttpRequest in that piece of code, and it seemed more logical to move it over there. More changes coming, there is a plan for this madness... :wink: