not all clients are good citizens and set HTTP_HOST, leading to NilClass#downcase being called.

Just a tiny refactoring that prevents #downcase being called on nil if the client neglects to set the HTTP_HOST header. All existing tests pass. Would you like a new test for this?