{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/37932735","id":37932735,"diff_hunk":"@@ -87,24 +86,34 @@ protected void transportHeadersReceived(Metadata headers) {\n       transportError = transportError.augmentDescription(headers.toString());\n       return;\n     }\n+\n+    // Verify that the HTTP status is OK.\n     Status httpStatus = statusFromHttpStatus(headers);\n-    if (httpStatus == null) {\n-      transportError = Status.INTERNAL.withDescription(\n-          \"received non-terminal headers with no :status\");\n-    } else if (!httpStatus.isOk()) {\n-      transportError = httpStatus;\n-    } else {\n-      transportError = checkContentType(headers);\n-    }\n-    if (transportError != null) {\n+    if (httpStatus == null || !httpStatus.isOk()) {\n+      transportError = httpStatus != null ? httpStatus : Status.INTERNAL.withDescription(\n+              \"received non-terminal headers with no :status\");\n+\n+      // TODO(nmittler): What to do if nothing else comes?\n+      // The error is generated from the HTTP status.\n       // Note we don't immediately report the transport error, instead we wait for more data on the\n       // stream so we can accumulate more detail into the error before reporting it.\n       transportError = transportError.augmentDescription(\"\\n\" + headers.toString());\n       errorCharset = extractCharset(headers);\n-    } else {\n-      stripTransportDetails(headers);\n-      inboundHeadersReceived(headers);\n+      return;\n     }\n+\n+    // Verify that the content type is appropriate for gRPC.\n+    transportError = checkContentType(headers);\n+    if (transportError != null) {\n+      // The request contained an invalid Content-Type, cancel the stream now.","path":"core/src/main/java/io/grpc/internal/Http2ClientStream.java","position":43,"original_position":43,"commit_id":"b116f52b953fd5acec5c3aaef4ad61e69318a0c7","original_commit_id":"b116f52b953fd5acec5c3aaef4ad61e69318a0c7","user":{"login":"ejona86","id":2811396,"avatar_url":"https://avatars.githubusercontent.com/u/2811396?v=3","gravatar_id":"","url":"https://api.github.com/users/ejona86","html_url":"https://github.com/ejona86","followers_url":"https://api.github.com/users/ejona86/followers","following_url":"https://api.github.com/users/ejona86/following{/other_user}","gists_url":"https://api.github.com/users/ejona86/gists{/gist_id}","starred_url":"https://api.github.com/users/ejona86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejona86/subscriptions","organizations_url":"https://api.github.com/users/ejona86/orgs","repos_url":"https://api.github.com/users/ejona86/repos","events_url":"https://api.github.com/users/ejona86/events{/privacy}","received_events_url":"https://api.github.com/users/ejona86/received_events","type":"User","site_admin":false},"body":"Why cancel the stream now and not accumulate the body's content like was already coded?","created_at":"2015-08-25T23:36:33Z","updated_at":"2015-08-25T23:36:33Z","html_url":"https://github.com/grpc/grpc-java/pull/872#discussion_r37932735","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/872","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/37932735"},"html":{"href":"https://github.com/grpc/grpc-java/pull/872#discussion_r37932735"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/872"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/872","id":43327722,"html_url":"https://github.com/grpc/grpc-java/pull/872","diff_url":"https://github.com/grpc/grpc-java/pull/872.diff","patch_url":"https://github.com/grpc/grpc-java/pull/872.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/872","number":872,"state":"open","locked":false,"title":"Enforce content-type on client and server.","user":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"body":"Fixes #360","created_at":"2015-08-25T19:42:25Z","updated_at":"2015-08-25T23:36:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b06c056df0c481a71efd4352e3bd6bfe0bc45af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/872/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/872/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/872/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/b116f52b953fd5acec5c3aaef4ad61e69318a0c7","head":{"label":"nmittler:check_content_type","ref":"check_content_type","sha":"b116f52b953fd5acec5c3aaef4ad61e69318a0c7","user":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"repo":{"id":31379300,"name":"grpc-java","full_name":"nmittler/grpc-java","owner":{"login":"nmittler","id":6493296,"avatar_url":"https://avatars.githubusercontent.com/u/6493296?v=3","gravatar_id":"","url":"https://api.github.com/users/nmittler","html_url":"https://github.com/nmittler","followers_url":"https://api.github.com/users/nmittler/followers","following_url":"https://api.github.com/users/nmittler/following{/other_user}","gists_url":"https://api.github.com/users/nmittler/gists{/gist_id}","starred_url":"https://api.github.com/users/nmittler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmittler/subscriptions","organizations_url":"https://api.github.com/users/nmittler/orgs","repos_url":"https://api.github.com/users/nmittler/repos","events_url":"https://api.github.com/users/nmittler/events{/privacy}","received_events_url":"https://api.github.com/users/nmittler/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nmittler/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/nmittler/grpc-java","forks_url":"https://api.github.com/repos/nmittler/grpc-java/forks","keys_url":"https://api.github.com/repos/nmittler/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nmittler/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nmittler/grpc-java/teams","hooks_url":"https://api.github.com/repos/nmittler/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/nmittler/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/nmittler/grpc-java/events","assignees_url":"https://api.github.com/repos/nmittler/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/nmittler/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/nmittler/grpc-java/tags","blobs_url":"https://api.github.com/repos/nmittler/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nmittler/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nmittler/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/nmittler/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nmittler/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/nmittler/grpc-java/languages","stargazers_url":"https://api.github.com/repos/nmittler/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/nmittler/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/nmittler/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/nmittler/grpc-java/subscription","commits_url":"https://api.github.com/repos/nmittler/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/nmittler/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/nmittler/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/nmittler/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/nmittler/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/nmittler/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nmittler/grpc-java/merges","archive_url":"https://api.github.com/repos/nmittler/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nmittler/grpc-java/downloads","issues_url":"https://api.github.com/repos/nmittler/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/nmittler/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/nmittler/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/nmittler/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nmittler/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/nmittler/grpc-java/releases{/id}","created_at":"2015-02-26T17:29:20Z","updated_at":"2015-03-03T21:47:37Z","pushed_at":"2015-08-25T19:59:17Z","git_url":"git://github.com/nmittler/grpc-java.git","ssh_url":"git@github.com:nmittler/grpc-java.git","clone_url":"https://github.com/nmittler/grpc-java.git","svn_url":"https://github.com/nmittler/grpc-java","homepage":"","size":4216,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"777e9285368ce00cfeebaec17705806503a66fe4","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729926,"name":"grpc-java","full_name":"grpc/grpc-java","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":false,"url":"https://api.github.com/repos/grpc/grpc-java","forks_url":"https://api.github.com/repos/grpc/grpc-java/forks","keys_url":"https://api.github.com/repos/grpc/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc-java/teams","hooks_url":"https://api.github.com/repos/grpc/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc-java/events","assignees_url":"https://api.github.com/repos/grpc/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc-java/tags","blobs_url":"https://api.github.com/repos/grpc/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc-java/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc-java/subscription","commits_url":"https://api.github.com/repos/grpc/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc-java/merges","archive_url":"https://api.github.com/repos/grpc/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc-java/downloads","issues_url":"https://api.github.com/repos/grpc/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc-java/releases{/id}","created_at":"2014-12-08T19:00:00Z","updated_at":"2015-08-25T16:31:24Z","pushed_at":"2015-08-25T22:41:28Z","git_url":"git://github.com/grpc/grpc-java.git","ssh_url":"git@github.com:grpc/grpc-java.git","clone_url":"https://github.com/grpc/grpc-java.git","svn_url":"https://github.com/grpc/grpc-java","homepage":"","size":22466,"stargazers_count":839,"watchers_count":839,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":199,"mirror_url":null,"open_issues_count":110,"forks":199,"open_issues":110,"watchers":839,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/872"},"html":{"href":"https://github.com/grpc/grpc-java/pull/872"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/872"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/872/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/872/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/872/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/b116f52b953fd5acec5c3aaef4ad61e69318a0c7"}}}}