{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/81381973","pull_request_review_id":2367693,"id":81381973,"diff_hunk":"@@ -715,50 +726,61 @@ private Task WriteSuffix()\n             bool appCompleted)\n         {\n             var responseHeaders = FrameResponseHeaders;\n-            responseHeaders.SetReadOnly();\n \n             var hasConnection = responseHeaders.HasConnection;\n \n+            // Set whether response can have body\n+            _canHaveBody = StatusCanHaveBody(StatusCode) && Method != \"HEAD\";\n+\n             var end = SocketOutput.ProducingStart();\n             if (_keepAlive && hasConnection)\n             {\n                 var connectionValue = responseHeaders.HeaderConnection.ToString();\n                 _keepAlive = connectionValue.Equals(\"keep-alive\", StringComparison.OrdinalIgnoreCase);\n             }\n-\n-            if (!responseHeaders.HasTransferEncoding && !responseHeaders.HasContentLength)\n+            \n+            if (_canHaveBody)\n             {\n-                if (appCompleted)\n+                if (!responseHeaders.HasTransferEncoding && !responseHeaders.HasContentLength)\n                 {\n-                    // Don't set the Content-Length or Transfer-Encoding headers\n-                    // automatically for HEAD requests or 101, 204, 205, 304 responses.\n-                    if (Method != \"HEAD\" && StatusCanHaveBody(StatusCode))\n+                    if (appCompleted)\n                     {\n                         // Since the app has completed and we are only now generating\n                         // the headers we can safely set the Content-Length to 0.\n                         responseHeaders.SetRawContentLength(\"0\", _bytesContentLengthZero);\n                     }\n-                }\n-                else if(_keepAlive)","path":"src/Microsoft.AspNetCore.Server.Kestrel/Internal/Http/Frame.cs","position":196,"original_position":196,"commit_id":"d8c57d2ce36e631aba0a1ba517bc31ec356eca3c","original_commit_id":"d8c57d2ce36e631aba0a1ba517bc31ec356eca3c","user":{"login":"cesarbs","id":924164,"avatar_url":"https://avatars.githubusercontent.com/u/924164?v=3","gravatar_id":"","url":"https://api.github.com/users/cesarbs","html_url":"https://github.com/cesarbs","followers_url":"https://api.github.com/users/cesarbs/followers","following_url":"https://api.github.com/users/cesarbs/following{/other_user}","gists_url":"https://api.github.com/users/cesarbs/gists{/gist_id}","starred_url":"https://api.github.com/users/cesarbs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cesarbs/subscriptions","organizations_url":"https://api.github.com/users/cesarbs/orgs","repos_url":"https://api.github.com/users/cesarbs/repos","events_url":"https://api.github.com/users/cesarbs/events{/privacy}","received_events_url":"https://api.github.com/users/cesarbs/received_events","type":"User","site_admin":false},"body":"@benaadams I'm curious why you removed this condition in your change. I had to re-introduce the keep-alive check, otherwise some tests would fail.","created_at":"2016-09-30T17:28:10Z","updated_at":"2016-09-30T17:28:10Z","html_url":"https://github.com/aspnet/KestrelHttpServer/pull/962#discussion_r81381973","pull_request_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962","_links":{"self":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments/81381973"},"html":{"href":"https://github.com/aspnet/KestrelHttpServer/pull/962#discussion_r81381973"},"pull_request":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962","id":76840910,"html_url":"https://github.com/aspnet/KestrelHttpServer/pull/962","diff_url":"https://github.com/aspnet/KestrelHttpServer/pull/962.diff","patch_url":"https://github.com/aspnet/KestrelHttpServer/pull/962.patch","issue_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/962","number":962,"state":"open","locked":false,"title":"Don't emit TE header or body for non-body responses","user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"body":"Now doesn't emit TE or body for non body responses\r\n\r\nResolves #952","created_at":"2016-07-09T07:49:00Z","updated_at":"2016-09-30T17:28:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6267543b841a6103719352def81108775c53940","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962/commits","review_comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962/comments","review_comment_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/962/comments","statuses_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/d8c57d2ce36e631aba0a1ba517bc31ec356eca3c","head":{"label":"benaadams:flush-304-fix","ref":"flush-304-fix","sha":"d8c57d2ce36e631aba0a1ba517bc31ec356eca3c","user":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"repo":{"id":38999457,"name":"KestrelHttpServer","full_name":"benaadams/KestrelHttpServer","owner":{"login":"benaadams","id":1142958,"avatar_url":"https://avatars.githubusercontent.com/u/1142958?v=3","gravatar_id":"","url":"https://api.github.com/users/benaadams","html_url":"https://github.com/benaadams","followers_url":"https://api.github.com/users/benaadams/followers","following_url":"https://api.github.com/users/benaadams/following{/other_user}","gists_url":"https://api.github.com/users/benaadams/gists{/gist_id}","starred_url":"https://api.github.com/users/benaadams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benaadams/subscriptions","organizations_url":"https://api.github.com/users/benaadams/orgs","repos_url":"https://api.github.com/users/benaadams/repos","events_url":"https://api.github.com/users/benaadams/events{/privacy}","received_events_url":"https://api.github.com/users/benaadams/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benaadams/KestrelHttpServer","description":"A development web server for ASP.NET vNext based on libuv.","fork":true,"url":"https://api.github.com/repos/benaadams/KestrelHttpServer","forks_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/forks","keys_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/teams","hooks_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/hooks","issue_events_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/issues/events{/number}","events_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/events","assignees_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/assignees{/user}","branches_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/branches{/branch}","tags_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/tags","blobs_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/git/refs{/sha}","trees_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/statuses/{sha}","languages_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/languages","stargazers_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/stargazers","contributors_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/contributors","subscribers_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/subscribers","subscription_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/subscription","commits_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/commits{/sha}","git_commits_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/git/commits{/sha}","comments_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/comments{/number}","issue_comment_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/issues/comments{/number}","contents_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/contents/{+path}","compare_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/merges","archive_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/downloads","issues_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/issues{/number}","pulls_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/pulls{/number}","milestones_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/milestones{/number}","notifications_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/labels{/name}","releases_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/releases{/id}","deployments_url":"https://api.github.com/repos/benaadams/KestrelHttpServer/deployments","created_at":"2015-07-13T08:10:06Z","updated_at":"2016-05-10T10:57:21Z","pushed_at":"2016-09-28T22:43:40Z","git_url":"git://github.com/benaadams/KestrelHttpServer.git","ssh_url":"git@github.com:benaadams/KestrelHttpServer.git","clone_url":"https://github.com/benaadams/KestrelHttpServer.git","svn_url":"https://github.com/benaadams/KestrelHttpServer","homepage":"","size":3094,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"f2085b196860fd6206bb586bfc41af7cfdb5ddc3","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 web server for ASP.NET Core 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}","deployments_url":"https://api.github.com/repos/aspnet/KestrelHttpServer/deployments","created_at":"2014-05-30T22:46:28Z","updated_at":"2016-09-30T03:55:33Z","pushed_at":"2016-09-30T12:41:27Z","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":7147,"stargazers_count":1104,"watchers_count":1104,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":232,"mirror_url":null,"open_issues_count":62,"forks":232,"open_issues":62,"watchers":1104,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962"},"html":{"href":"https://github.com/aspnet/KestrelHttpServer/pull/962"},"issue":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/962"},"comments":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/issues/962/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/pulls/962/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/KestrelHttpServer/statuses/d8c57d2ce36e631aba0a1ba517bc31ec356eca3c"}}}}
{"actor":{"display_login":"cesarbs"}}