{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/37569688","id":37569688,"diff_hunk":"@@ -43,7 +43,8 @@ public IDisposable Start(IServerInformation serverInformation, Func<IFeatureColl\n             {\n                 disposables.Add(engine.CreateServer(\n                     address.Scheme,\n-                    address.Host,\n+                    // Unix sockets use a file path, not a hostname.\n+                    address.Scheme == Constants.UnixScheme ? address.Path : address.Host,","path":"src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs","position":17,"original_position":17,"commit_id":"9ade227abbba385bd42cbeb3b79ada721f40b7a3","original_commit_id":"9ade227abbba385bd42cbeb3b79ada721f40b7a3","user":{"login":"halter73","id":54385,"avatar_url":"https://avatars.githubusercontent.com/u/54385?v=3","gravatar_id":"","url":"https://api.github.com/users/halter73","html_url":"https://github.com/halter73","followers_url":"https://api.github.com/users/halter73/followers","following_url":"https://api.github.com/users/halter73/following{/other_user}","gists_url":"https://api.github.com/users/halter73/gists{/gist_id}","starred_url":"https://api.github.com/users/halter73/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/halter73/subscriptions","organizations_url":"https://api.github.com/users/halter73/orgs","repos_url":"https://api.github.com/users/halter73/repos","events_url":"https://api.github.com/users/halter73/events{/privacy}","received_events_url":"https://api.github.com/users/halter73/received_events","type":"User","site_admin":false},"body":"Can we include the scheme (e.g. http, https, fastcgi) in the address? Sorta like Nginix does in its proxy_pass directive, i.e. http://unix:/tmp/kestrel-test.sock.","created_at":"2015-08-20T19:16:04Z","updated_at":"2015-08-20T19:16:04Z","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/157#discussion_r37569688","pull_request_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157","_links":{"self":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/37569688"},"html":{"href":"https://github.com/aspnet/KestrelHttpServer/pull/157#discussion_r37569688"},"pull_request":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157","id":41983536,"html_url":"https://github.com/aspnet/KestrelHttpServer/pull/157","diff_url":"https://github.com/aspnet/KestrelHttpServer/pull/157.diff","patch_url":"https://github.com/aspnet/KestrelHttpServer/pull/157.patch","issue_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/157","number":157,"state":"open","locked":false,"title":"Implement support for UNIX sockets","user":{"login":"Daniel15","id":91933,"avatar_url":"https://avatars.githubusercontent.com/u/91933?v=3","gravatar_id":"","url":"https://api.github.com/users/Daniel15","html_url":"https://github.com/Daniel15","followers_url":"https://api.github.com/users/Daniel15/followers","following_url":"https://api.github.com/users/Daniel15/following{/other_user}","gists_url":"https://api.github.com/users/Daniel15/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel15/subscriptions","organizations_url":"https://api.github.com/users/Daniel15/orgs","repos_url":"https://api.github.com/users/Daniel15/repos","events_url":"https://api.github.com/users/Daniel15/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel15/received_events","type":"User","site_admin":false},"body":"The common use-case for Kestrel in production will be behind a reverse proxy such as Nginx. In cases where the reverse proxy is located on the same machine as the application, connecting via a UNIX socket is more efficient than a TCP socket, as it avoids going through the network layer. Accessing 127.0.0.1 through TCP still needs to initiate a TCP connection and perform handshaking, checksumming, etc, all of which is avoided by using UNIX sockets.\r\n\r\n - Moved TCP-specific stuff from Listener into new TcpListener class (same with ListenerPrimary and ListenerSecondary)\r\n - Made Listener abstract\r\n - Created new PipeListener. Note that while the use case is for UNIX sockets, this is called \"Pipe\" in uv, so I've called this \"PipeListener\" so the terminology is consistant\r\n - Uses \"unix\" URL scheme to determine whether to use socket. \"http://127.0.0.1:5000\" is for listening via TCP while \"unix:///var/run/kestrel-test.sock\" is for listening via UNIX socket\r\n\r\nExample Nginx configuration for proxying to a UNIX socket:\r\n```nginx\r\nserver {\r\n  server_name kestreltest.localhost;\r\n  root /var/www/dan.cx/net5test/wwwroot;\r\n\r\n  location / {\r\n    # Serve static files directly; proxy everything else to Kestrel\r\n    try_files $uri @aspnet;\r\n  }\r\n\r\n  location @aspnet {\r\n    proxy_pass http://unix:/tmp/kestrel-test.sock;\r\n    proxy_set_header Host $host;\r\n  }\r\n}\r\n```\r\n\r\n#156","created_at":"2015-08-10T02:45:45Z","updated_at":"2015-08-20T19:16:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1411c20c9d3c18a6bf1c4e33eeae7db9839cd36","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157/commits","review_comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157/comments","review_comment_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/157/comments","statuses_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/9ade227abbba385bd42cbeb3b79ada721f40b7a3","head":{"label":"Daniel15:unix-sockets","ref":"unix-sockets","sha":"9ade227abbba385bd42cbeb3b79ada721f40b7a3","user":{"login":"Daniel15","id":91933,"avatar_url":"https://avatars.githubusercontent.com/u/91933?v=3","gravatar_id":"","url":"https://api.github.com/users/Daniel15","html_url":"https://github.com/Daniel15","followers_url":"https://api.github.com/users/Daniel15/followers","following_url":"https://api.github.com/users/Daniel15/following{/other_user}","gists_url":"https://api.github.com/users/Daniel15/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel15/subscriptions","organizations_url":"https://api.github.com/users/Daniel15/orgs","repos_url":"https://api.github.com/users/Daniel15/repos","events_url":"https://api.github.com/users/Daniel15/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel15/received_events","type":"User","site_admin":false},"repo":{"id":40459180,"name":"KestrelHttpServer","full_name":"Daniel15/KestrelHttpServer","owner":{"login":"Daniel15","id":91933,"avatar_url":"https://avatars.githubusercontent.com/u/91933?v=3","gravatar_id":"","url":"https://api.github.com/users/Daniel15","html_url":"https://github.com/Daniel15","followers_url":"https://api.github.com/users/Daniel15/followers","following_url":"https://api.github.com/users/Daniel15/following{/other_user}","gists_url":"https://api.github.com/users/Daniel15/gists{/gist_id}","starred_url":"https://api.github.com/users/Daniel15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daniel15/subscriptions","organizations_url":"https://api.github.com/users/Daniel15/orgs","repos_url":"https://api.github.com/users/Daniel15/repos","events_url":"https://api.github.com/users/Daniel15/events{/privacy}","received_events_url":"https://api.github.com/users/Daniel15/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Daniel15/KestrelHttpServer","description":"A development web server for ASP.NET vNext based on libuv.","fork":true,"url":"https://api.github.com/repos/Daniel15/KestrelHttpServer","forks_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/forks","keys_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/teams","hooks_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/hooks","issue_events_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/issues/events{/number}","events_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/events","assignees_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/assignees{/user}","branches_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/branches{/branch}","tags_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/tags","blobs_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/statuses/{sha}","languages_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/languages","stargazers_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/stargazers","contributors_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/contributors","subscribers_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/subscribers","subscription_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/subscription","commits_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/issues/comments{/number}","contents_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/contents/{+path}","compare_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/merges","archive_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/downloads","issues_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/issues{/number}","pulls_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/pulls{/number}","milestones_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/milestones{/number}","notifications_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/labels{/name}","releases_url":"https://api.github.com/repos/Daniel15/KestrelHttpServer/releases{/id}","created_at":"2015-08-10T02:28:12Z","updated_at":"2015-08-10T02:28:13Z","pushed_at":"2015-08-15T22:51:35Z","git_url":"git://github.com/Daniel15/KestrelHttpServer.git","ssh_url":"git@github.com:Daniel15/KestrelHttpServer.git","clone_url":"https://github.com/Daniel15/KestrelHttpServer.git","svn_url":"https://github.com/Daniel15/KestrelHttpServer","homepage":"","size":1063,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"62a909d1a75f7b9569ab07d4a83371bdc9cf6faf","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":20344662,"name":"KestrelHttpServer","full_name":"aspnet/KestrelHttpServer","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/KestrelHttpServer","description":"A development web server for ASP.NET vNext based on libuv.","fork":false,"url":"https://api.github.com/repos/aspnet/KestrelHttpServer","forks_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/forks","keys_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/teams","hooks_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/hooks","issue_events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/events","assignees_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/tags","blobs_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/languages","stargazers_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/stargazers","contributors_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/contributors","subscribers_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/subscribers","subscription_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/subscription","commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/merges","archive_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/downloads","issues_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/releases{/id}","created_at":"2014-05-30T22:46:28Z","updated_at":"2015-08-17T04:01:30Z","pushed_at":"2015-08-20T18:58:08Z","git_url":"git://github.com/aspnet/KestrelHttpServer.git","ssh_url":"git@github.com:aspnet/KestrelHttpServer.git","clone_url":"https://github.com/aspnet/KestrelHttpServer.git","svn_url":"https://github.com/aspnet/KestrelHttpServer","homepage":"","size":3401,"stargazers_count":386,"watchers_count":386,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":65,"mirror_url":null,"open_issues_count":42,"forks":65,"open_issues":42,"watchers":386,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157"},"html":{"href":"https://github.com/aspnet/KestrelHttpServer/pull/157"},"issue":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/157"},"comments":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/157/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/157/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/9ade227abbba385bd42cbeb3b79ada721f40b7a3"}}}}