{"action":"created","comment":{"url":"https://api.github.com/repos/playframework/playframework/pulls/comments/69933408","id":69933408,"diff_hunk":"@@ -64,7 +65,7 @@ object ServerResultUtils {\n         )\n         originalErrorResult.copy(header = newHeader)\n       }\n-    } else if (!mayHaveEntity(result.header.status) && !result.body.isKnownEmpty) {\n+    } else if (mustNotIncludeBody(result.header.status)) {","path":"framework/src/play-server/src/main/scala/play/core/server/common/ServerResultUtils.scala","position":null,"original_position":13,"commit_id":"d14c6aacbda825d108f8479e3183f2d460d0cd53","original_commit_id":"0ac4a14b4f198bc8519692b2758b69baf0c6ffd7","user":{"login":"monkey-mas","id":5261677,"avatar_url":"https://avatars.githubusercontent.com/u/5261677?v=3","gravatar_id":"","url":"https://api.github.com/users/monkey-mas","html_url":"https://github.com/monkey-mas","followers_url":"https://api.github.com/users/monkey-mas/followers","following_url":"https://api.github.com/users/monkey-mas/following{/other_user}","gists_url":"https://api.github.com/users/monkey-mas/gists{/gist_id}","starred_url":"https://api.github.com/users/monkey-mas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkey-mas/subscriptions","organizations_url":"https://api.github.com/users/monkey-mas/orgs","repos_url":"https://api.github.com/users/monkey-mas/repos","events_url":"https://api.github.com/users/monkey-mas/events{/privacy}","received_events_url":"https://api.github.com/users/monkey-mas/received_events","type":"User","site_admin":false},"body":"oh I see, as we have `Future.successful(result.copy(body = HttpEntity.Strict(ByteString.empty, result.body.contentType)))` two lines below this condition.\r\nThanks for your review! Fixed it! :)","created_at":"2016-07-07T15:53:33Z","updated_at":"2016-07-07T15:53:33Z","html_url":"https://github.com/playframework/playframework/pull/6261#discussion_r69933408","pull_request_url":"https://api.github.com/repos/playframework/playframework/pulls/6261","_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments/69933408"},"html":{"href":"https://github.com/playframework/playframework/pull/6261#discussion_r69933408"},"pull_request":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6261"}}},"pull_request":{"url":"https://api.github.com/repos/playframework/playframework/pulls/6261","id":74802975,"html_url":"https://github.com/playframework/playframework/pull/6261","diff_url":"https://github.com/playframework/playframework/pull/6261.diff","patch_url":"https://github.com/playframework/playframework/pull/6261.patch","issue_url":"https://api.github.com/repos/playframework/playframework/issues/6261","number":6261,"state":"open","locked":false,"title":"Don't allow users to set a Content-Length header field in a 204 response","user":{"login":"monkey-mas","id":5261677,"avatar_url":"https://avatars.githubusercontent.com/u/5261677?v=3","gravatar_id":"","url":"https://api.github.com/users/monkey-mas","html_url":"https://github.com/monkey-mas","followers_url":"https://api.github.com/users/monkey-mas/followers","following_url":"https://api.github.com/users/monkey-mas/following{/other_user}","gists_url":"https://api.github.com/users/monkey-mas/gists{/gist_id}","starred_url":"https://api.github.com/users/monkey-mas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkey-mas/subscriptions","organizations_url":"https://api.github.com/users/monkey-mas/orgs","repos_url":"https://api.github.com/users/monkey-mas/repos","events_url":"https://api.github.com/users/monkey-mas/events{/privacy}","received_events_url":"https://api.github.com/users/monkey-mas/received_events","type":"User","site_admin":false},"body":"# Pull Request Checklist\r\n\r\n* [x] Have you read [How to write the perfect pull request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request)?\r\n* [x] Have you read through the [contributor guidelines](https://www.playframework.com/contributing)?\r\n* [x] Have you signed the [Lightbend CLA](https://www.lightbend.com/contribute/cla)?\r\n* [ ] Have you [squashed your commits](https://www.playframework.com/documentation/2.4.x/WorkingWithGit#Squashing-commits)?\r\n* [x] Have you added copyright headers to new files?\r\n* [x] Have you checked that both Scala and Java APIs are updated?\r\n* [x] Have you updated the documentation for both Scala and Java sections?\r\n* [x] Have you added tests for any changed functionality?\r\n\r\n## Fixes\r\n\r\nThis fix makes sure that Play never sends Content-Length header field for a 204 response.\r\n\r\n## Purpose\r\n\r\nAs described in [RFC7230 section-3.3.2](https://tools.ietf.org/html/rfc7230#section-3.3.2), sending a Content-Length header field is not allowed in any response with a status code of 1xx (Informational) or 204 (No Content). This requirement was not forced in Play, which means a user can intentionally set a Content-Length header. To follow the RFC section, we need to make sure that we don't send the header field.\r\nWith regard to a Content-Length header field in a 304 response, a server May send it as mentioned in RFC7230 section-3.3.2. Thus it'd be better for us to allow users to set the field if they like.\r\n\r\n## Background Context\r\n\r\nAs I've mentioned in Purpose.\r\n\r\n## References\r\n\r\n- Related Issues/PRs\r\n  - [content-length header included in 304 response which is forbidden by the HTTP spec](https://github.com/playframework/playframework/issues/3899)\r\n  - [Don't include body and Content-Length in 204 and 304 responses. Fixes #3899](https://github.com/playframework/playframework/pull/3939)\r\n\r\n- The following is the partial citation from RFC7230 section-3.3.2.\r\n```\r\nA server MUST NOT send a Content-Length header field in any response with\r\na status code of 1xx (Informational) or 204 (No Content). A server MUST NOT send\r\na Content-Length header field in any 2xx(Successful) response to a CONNECT request\r\n(Section 4.3.6 of [RFC7231]).\r\n```\r\n```\r\nA server MAY send a Content-Length header field in a 304 (Not Modified) response to\r\na conditional GET request (Section 4.1 of [RFC7232]); a server MUST NOT send\r\nContent-Length in such a response unless its field-value equals the decimal number of\r\noctets that would have been sent in the payload body of a 200 (OK) response to\r\nthe same request.\r\n```\r\n\r\nP.S.\r\n`play.it.http.NettyScalaResultsHandlingSpec` appends a `Content-Length: 0` header field\r\nwhen we explicitly send it, but `AkkaHttpIntegrationSpecification` does not.\r\n\r\n","created_at":"2016-06-22T15:17:08Z","updated_at":"2016-07-07T15:53:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"950669a394aa7293d67499a17dd2bdf1e239afec","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/playframework/playframework/pulls/6261/commits","review_comments_url":"https://api.github.com/repos/playframework/playframework/pulls/6261/comments","review_comment_url":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/playframework/playframework/issues/6261/comments","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/d14c6aacbda825d108f8479e3183f2d460d0cd53","head":{"label":"monkey-mas:remove-content-length-header-in-204","ref":"remove-content-length-header-in-204","sha":"d14c6aacbda825d108f8479e3183f2d460d0cd53","user":{"login":"monkey-mas","id":5261677,"avatar_url":"https://avatars.githubusercontent.com/u/5261677?v=3","gravatar_id":"","url":"https://api.github.com/users/monkey-mas","html_url":"https://github.com/monkey-mas","followers_url":"https://api.github.com/users/monkey-mas/followers","following_url":"https://api.github.com/users/monkey-mas/following{/other_user}","gists_url":"https://api.github.com/users/monkey-mas/gists{/gist_id}","starred_url":"https://api.github.com/users/monkey-mas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkey-mas/subscriptions","organizations_url":"https://api.github.com/users/monkey-mas/orgs","repos_url":"https://api.github.com/users/monkey-mas/repos","events_url":"https://api.github.com/users/monkey-mas/events{/privacy}","received_events_url":"https://api.github.com/users/monkey-mas/received_events","type":"User","site_admin":false},"repo":{"id":61643163,"name":"playframework","full_name":"monkey-mas/playframework","owner":{"login":"monkey-mas","id":5261677,"avatar_url":"https://avatars.githubusercontent.com/u/5261677?v=3","gravatar_id":"","url":"https://api.github.com/users/monkey-mas","html_url":"https://github.com/monkey-mas","followers_url":"https://api.github.com/users/monkey-mas/followers","following_url":"https://api.github.com/users/monkey-mas/following{/other_user}","gists_url":"https://api.github.com/users/monkey-mas/gists{/gist_id}","starred_url":"https://api.github.com/users/monkey-mas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monkey-mas/subscriptions","organizations_url":"https://api.github.com/users/monkey-mas/orgs","repos_url":"https://api.github.com/users/monkey-mas/repos","events_url":"https://api.github.com/users/monkey-mas/events{/privacy}","received_events_url":"https://api.github.com/users/monkey-mas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/monkey-mas/playframework","description":"Play Framework","fork":true,"url":"https://api.github.com/repos/monkey-mas/playframework","forks_url":"https://api.github.com/repos/monkey-mas/playframework/forks","keys_url":"https://api.github.com/repos/monkey-mas/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monkey-mas/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monkey-mas/playframework/teams","hooks_url":"https://api.github.com/repos/monkey-mas/playframework/hooks","issue_events_url":"https://api.github.com/repos/monkey-mas/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/monkey-mas/playframework/events","assignees_url":"https://api.github.com/repos/monkey-mas/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/monkey-mas/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/monkey-mas/playframework/tags","blobs_url":"https://api.github.com/repos/monkey-mas/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monkey-mas/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monkey-mas/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/monkey-mas/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monkey-mas/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/monkey-mas/playframework/languages","stargazers_url":"https://api.github.com/repos/monkey-mas/playframework/stargazers","contributors_url":"https://api.github.com/repos/monkey-mas/playframework/contributors","subscribers_url":"https://api.github.com/repos/monkey-mas/playframework/subscribers","subscription_url":"https://api.github.com/repos/monkey-mas/playframework/subscription","commits_url":"https://api.github.com/repos/monkey-mas/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/monkey-mas/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/monkey-mas/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/monkey-mas/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/monkey-mas/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/monkey-mas/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monkey-mas/playframework/merges","archive_url":"https://api.github.com/repos/monkey-mas/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monkey-mas/playframework/downloads","issues_url":"https://api.github.com/repos/monkey-mas/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/monkey-mas/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/monkey-mas/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/monkey-mas/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monkey-mas/playframework/labels{/name}","releases_url":"https://api.github.com/repos/monkey-mas/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/monkey-mas/playframework/deployments","created_at":"2016-06-21T14:59:54Z","updated_at":"2016-06-21T15:00:04Z","pushed_at":"2016-07-07T15:50:55Z","git_url":"git://github.com/monkey-mas/playframework.git","ssh_url":"git@github.com:monkey-mas/playframework.git","clone_url":"https://github.com/monkey-mas/playframework.git","svn_url":"https://github.com/monkey-mas/playframework","homepage":"http://www.playframework.com/","size":85063,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"playframework:master","ref":"master","sha":"f00e29a063d20214e9b615775f3fa7b7a9331c06","user":{"login":"playframework","id":319107,"avatar_url":"https://avatars.githubusercontent.com/u/319107?v=3","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"repo":{"id":2340549,"name":"playframework","full_name":"playframework/playframework","owner":{"login":"playframework","id":319107,"avatar_url":"https://avatars.githubusercontent.com/u/319107?v=3","gravatar_id":"","url":"https://api.github.com/users/playframework","html_url":"https://github.com/playframework","followers_url":"https://api.github.com/users/playframework/followers","following_url":"https://api.github.com/users/playframework/following{/other_user}","gists_url":"https://api.github.com/users/playframework/gists{/gist_id}","starred_url":"https://api.github.com/users/playframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/playframework/subscriptions","organizations_url":"https://api.github.com/users/playframework/orgs","repos_url":"https://api.github.com/users/playframework/repos","events_url":"https://api.github.com/users/playframework/events{/privacy}","received_events_url":"https://api.github.com/users/playframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/playframework/playframework","description":"Play Framework","fork":false,"url":"https://api.github.com/repos/playframework/playframework","forks_url":"https://api.github.com/repos/playframework/playframework/forks","keys_url":"https://api.github.com/repos/playframework/playframework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/playframework/playframework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/playframework/playframework/teams","hooks_url":"https://api.github.com/repos/playframework/playframework/hooks","issue_events_url":"https://api.github.com/repos/playframework/playframework/issues/events{/number}","events_url":"https://api.github.com/repos/playframework/playframework/events","assignees_url":"https://api.github.com/repos/playframework/playframework/assignees{/user}","branches_url":"https://api.github.com/repos/playframework/playframework/branches{/branch}","tags_url":"https://api.github.com/repos/playframework/playframework/tags","blobs_url":"https://api.github.com/repos/playframework/playframework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/playframework/playframework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/playframework/playframework/git/refs{/sha}","trees_url":"https://api.github.com/repos/playframework/playframework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/playframework/playframework/statuses/{sha}","languages_url":"https://api.github.com/repos/playframework/playframework/languages","stargazers_url":"https://api.github.com/repos/playframework/playframework/stargazers","contributors_url":"https://api.github.com/repos/playframework/playframework/contributors","subscribers_url":"https://api.github.com/repos/playframework/playframework/subscribers","subscription_url":"https://api.github.com/repos/playframework/playframework/subscription","commits_url":"https://api.github.com/repos/playframework/playframework/commits{/sha}","git_commits_url":"https://api.github.com/repos/playframework/playframework/git/commits{/sha}","comments_url":"https://api.github.com/repos/playframework/playframework/comments{/number}","issue_comment_url":"https://api.github.com/repos/playframework/playframework/issues/comments{/number}","contents_url":"https://api.github.com/repos/playframework/playframework/contents/{+path}","compare_url":"https://api.github.com/repos/playframework/playframework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/playframework/playframework/merges","archive_url":"https://api.github.com/repos/playframework/playframework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/playframework/playframework/downloads","issues_url":"https://api.github.com/repos/playframework/playframework/issues{/number}","pulls_url":"https://api.github.com/repos/playframework/playframework/pulls{/number}","milestones_url":"https://api.github.com/repos/playframework/playframework/milestones{/number}","notifications_url":"https://api.github.com/repos/playframework/playframework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/playframework/playframework/labels{/name}","releases_url":"https://api.github.com/repos/playframework/playframework/releases{/id}","deployments_url":"https://api.github.com/repos/playframework/playframework/deployments","created_at":"2011-09-07T09:24:08Z","updated_at":"2016-07-07T15:08:38Z","pushed_at":"2016-07-07T15:50:59Z","git_url":"git://github.com/playframework/playframework.git","ssh_url":"git@github.com:playframework/playframework.git","clone_url":"https://github.com/playframework/playframework.git","svn_url":"https://github.com/playframework/playframework","homepage":"http://www.playframework.com/","size":96586,"stargazers_count":8068,"watchers_count":8068,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2791,"mirror_url":null,"open_issues_count":286,"forks":2791,"open_issues":286,"watchers":8068,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6261"},"html":{"href":"https://github.com/playframework/playframework/pull/6261"},"issue":{"href":"https://api.github.com/repos/playframework/playframework/issues/6261"},"comments":{"href":"https://api.github.com/repos/playframework/playframework/issues/6261/comments"},"review_comments":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6261/comments"},"review_comment":{"href":"https://api.github.com/repos/playframework/playframework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/playframework/playframework/pulls/6261/commits"},"statuses":{"href":"https://api.github.com/repos/playframework/playframework/statuses/d14c6aacbda825d108f8479e3183f2d460d0cd53"}}}}
{"actor":{"display_login":"monkey-mas"}}