{"action":"created","issue":{"url":"https://api.github.com/repos/http4s/http4s/issues/240","labels_url":"https://api.github.com/repos/http4s/http4s/issues/240/labels{/name}","comments_url":"https://api.github.com/repos/http4s/http4s/issues/240/comments","events_url":"https://api.github.com/repos/http4s/http4s/issues/240/events","html_url":"https://github.com/http4s/http4s/issues/240","id":64899959,"number":240,"title":"Setting a Host header for a blaze client Request causes an exception to be thrown","user":{"login":"dchenbecker","id":24858,"avatar_url":"https://avatars.githubusercontent.com/u/24858?v=3","gravatar_id":"","url":"https://api.github.com/users/dchenbecker","html_url":"https://github.com/dchenbecker","followers_url":"https://api.github.com/users/dchenbecker/followers","following_url":"https://api.github.com/users/dchenbecker/following{/other_user}","gists_url":"https://api.github.com/users/dchenbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dchenbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchenbecker/subscriptions","organizations_url":"https://api.github.com/users/dchenbecker/orgs","repos_url":"https://api.github.com/users/dchenbecker/repos","events_url":"https://api.github.com/users/dchenbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dchenbecker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/http4s/http4s/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-28T05:13:14Z","updated_at":"2015-03-28T13:59:44Z","closed_at":null,"body":"The issue appears to be faulty logic here:\r\n\r\nhttps://github.com/http4s/http4s/blob/master/blaze-client/src/main/scala/org/http4s/client/blaze/Http1ClientStage.scala#L146\r\n\r\nBasically, if Http/1.1 and a \"Host\" header exists, throw an exception. This seems so obviously wrong to me I feel like I must be missing something. It leads to hilarity like:\r\n\r\n```\r\nscala> val reqUri = Uri.fromString(\"http://foo.com/index.html\").fold(_ => throw new Exception(\"Boo\"), identity)\r\nreqUri: org.http4s.Uri = http://foo.com/index.html\r\n\r\nscala> val req = Request(uri = reqUri).withHeaders(Header.Host(\"bar.com\"))\r\nwarning: there was one deprecation warning; re-run with -deprecation for details\r\nreq: org.http4s.Request = Request(GET,http://foo.com/index.html,HTTP/1.1,Headers(Host: bar.com),Halt(End),org.http4s.AttributeMap@1b7e58a2)\r\n\r\nscala> defaultClient(req).run\r\nSLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".\r\nSLF4J: Defaulting to no-operation (NOP) logger implementation\r\nSLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\r\njava.lang.RuntimeException: Request URI must have a host.\r\n  at scala.sys.package$.error(package.scala:27)\r\n  at org.http4s.client.blaze.Http1ClientStage.org$http4s$client$blaze$Http1ClientStage$$encodeRequestLine(Http1ClientStage.scala:146)\r\n```\r\n\r\nIf there's agreement that this is wrong, I'm happy to submit a PR to fix it."},"comment":{"url":"https://api.github.com/repos/http4s/http4s/issues/comments/87232462","html_url":"https://github.com/http4s/http4s/issues/240#issuecomment-87232462","issue_url":"https://api.github.com/repos/http4s/http4s/issues/240","id":87232462,"user":{"login":"dchenbecker","id":24858,"avatar_url":"https://avatars.githubusercontent.com/u/24858?v=3","gravatar_id":"","url":"https://api.github.com/users/dchenbecker","html_url":"https://github.com/dchenbecker","followers_url":"https://api.github.com/users/dchenbecker/followers","following_url":"https://api.github.com/users/dchenbecker/following{/other_user}","gists_url":"https://api.github.com/users/dchenbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dchenbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dchenbecker/subscriptions","organizations_url":"https://api.github.com/users/dchenbecker/orgs","repos_url":"https://api.github.com/users/dchenbecker/repos","events_url":"https://api.github.com/users/dchenbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dchenbecker/received_events","type":"User","site_admin":false},"created_at":"2015-03-28T13:59:44Z","updated_at":"2015-03-28T13:59:44Z","body":"https://github.com/http4s/http4s/pull/241 has a fix against master. Would a fix for 0.6.x be useful, too?"}}