Added parameter check when setting Host header

Fixes #504