Fixing status code, adding host option

* Redirect status code is now 302 (was 403)
* host can be set in options, otherwise hostname is used (no port number)
* simplified url generation
* updated tests