Move url resolving to *before* the request has been prepared.

This resolves issue #193, allowing cookies being matched against the correct (resolved) domain and correctly sent back to the server.