{"action":"opened","issue":{"url":"https://api.github.com/repos/excon/excon/issues/547","repository_url":"https://api.github.com/repos/excon/excon","labels_url":"https://api.github.com/repos/excon/excon/issues/547/labels{/name}","comments_url":"https://api.github.com/repos/excon/excon/issues/547/comments","events_url":"https://api.github.com/repos/excon/excon/issues/547/events","html_url":"https://github.com/excon/excon/issues/547","id":135754330,"number":547,"title":"Host header for HTTP requests over UNIX sockets not empty","user":{"login":"Papierkorb","id":737062,"avatar_url":"https://avatars.githubusercontent.com/u/737062?v=3","gravatar_id":"","url":"https://api.github.com/users/Papierkorb","html_url":"https://github.com/Papierkorb","followers_url":"https://api.github.com/users/Papierkorb/followers","following_url":"https://api.github.com/users/Papierkorb/following{/other_user}","gists_url":"https://api.github.com/users/Papierkorb/gists{/gist_id}","starred_url":"https://api.github.com/users/Papierkorb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Papierkorb/subscriptions","organizations_url":"https://api.github.com/users/Papierkorb/orgs","repos_url":"https://api.github.com/users/Papierkorb/repos","events_url":"https://api.github.com/users/Papierkorb/events{/privacy}","received_events_url":"https://api.github.com/users/Papierkorb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-23T14:39:59Z","updated_at":"2016-02-23T14:39:59Z","closed_at":null,"body":"Hello,\r\n\r\nToday I noticed that with the latest Docker, the `docker-api` gem failed to communicate with the Docker daemon. It always returned a \"400 Bad Request\" response.\r\n\r\nAfter some digging I found that the HTTP gem it uses is `Excon`. The problem is that the value for the `Host` header in the request is not *empty*.\r\n\r\nI reproduced the issue with the following set up on my Linux computer:\r\n\r\n1. Use the *socat* tool to open a UNIX listen socket: `socat UNIX-LISTEN:foo.sock STDOUT`\r\n2. Open irb or pry in another window, require 'excon' and do a GET request: `Excon.get 'unix:/foo.sock/whatever', socket: 'foo.sock'`  (Note: The example expects that both commands have the same working directory)\r\n\r\nThis gives the following output in the `socat` window:\r\n\r\n    GET /foo.sock/whatever HTTP/1.1\r\n    User-Agent: excon/0.45.4\r\n    Host: foo.sock\r\n\r\nPlease note the value for the `Host` header is `foo.sock`. But according to the specification of HTTP it must be empty. Reference [RFC2616, Section 14.26](https://tools.ietf.org/html/rfc2616#section-14.23):\r\n\r\n    A client MUST include a Host header field in all HTTP/1.1 request\r\n    messages . If the requested URI does not include an Internet host\r\n    name for the service being requested, then the Host header field MUST\r\n    be given with an empty value.\r\n\r\nThanks for reading!"}}