{"action":"created","comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/149307062","pull_request_review_id":74678292,"id":149307062,"diff_hunk":"@@ -473,6 +484,55 @@ ServerContextImpl::ServerContextImpl(ContextManagerImpl& parent, Stats::Scope& s\n   RELEASE_ASSERT(rc == 1);\n }\n \n+ssl_select_cert_result_t\n+ServerContextImpl::processClientHello(const SSL_CLIENT_HELLO* client_hello) {\n+  std::string server_name = EMPTY_STRING;\n+  const uint8_t* data;\n+  size_t len;\n+\n+  if (SSL_early_callback_ctx_extension_get(client_hello, TLSEXT_TYPE_server_name, &data, &len)) {\n+    /* Based on BoringSSL's ext_sni_parse_clienthello(). Match on empty SNI if we encounter any\n+     * errors. */\n+    CBS extension;\n+    CBS_init(&extension, data, len);\n+    CBS server_name_list, host_name;\n+    uint8_t name_type;\n+    if (CBS_get_u16_length_prefixed(&extension, &server_name_list) &&\n+        CBS_get_u8(&server_name_list, &name_type) &&\n+        CBS_get_u16_length_prefixed(&server_name_list, &host_name) &&\n+        CBS_len(&server_name_list) == 0 && CBS_len(&extension) == 0 &&\n+        name_type == TLSEXT_NAMETYPE_host_name && CBS_len(&host_name) != 0 &&\n+        CBS_len(&host_name) <= TLSEXT_MAXLEN_host_name && !CBS_contains_zero_byte(&host_name)) {\n+      server_name =\n+          std::string(reinterpret_cast<const char*>(CBS_data(&host_name)), CBS_len(&host_name));\n+    }\n+  }\n+\n+  ServerContext* new_ctx = parent_.findSslServerContext(listener_name_, server_name);\n+\n+  // Reject connection if we didn't find a match.\n+  if (new_ctx == nullptr) {\n+    return ssl_select_cert_error;\n+  }\n+\n+  // Update context if it changed.\n+  if (new_ctx != this) {\n+    ServerContextImpl* new_impl = dynamic_cast<ServerContextImpl*>(new_ctx);\n+    new_impl->updateConnection(client_hello->ssl);\n+  }\n+\n+  return ssl_select_cert_success;\n+}\n+\n+void ServerContextImpl::updateConnection(SSL* ssl) {\n+  RELEASE_ASSERT(ctx_);","path":"source/common/ssl/context_impl.cc","position":null,"original_position":77,"commit_id":"33142cc584a2dc38e87988c5543a70c0096507eb","original_commit_id":"76709a08a851c9b96039e8aa9ca9dbb7b490e176","user":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2017-11-07T09:12:34Z","updated_at":"2017-11-07T09:12:34Z","html_url":"https://github.com/envoyproxy/envoy/pull/1984#discussion_r149307062","pull_request_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/149307062"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/1984#discussion_r149307062"},"pull_request":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984"}},"in_reply_to_id":148590031},"pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984","id":150149181,"html_url":"https://github.com/envoyproxy/envoy/pull/1984","diff_url":"https://github.com/envoyproxy/envoy/pull/1984.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/1984.patch","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/1984","number":1984,"state":"open","locked":false,"title":"ssl: add support for SNI.","user":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"body":"This version serves different TLS certificates based on SNI,\r\nbut it doesn't select alternative filter chains.\r\n\r\nPartially fixes #95.","created_at":"2017-11-01T21:19:40Z","updated_at":"2017-11-07T09:12:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"430289fabc138c319ffe97ab29892bd3afaf47f1","assignee":null,"assignees":[],"requested_reviewers":[{"login":"dnoe","id":1183641,"avatar_url":"https://avatars2.githubusercontent.com/u/1183641?v=4","gravatar_id":"","url":"https://api.github.com/users/dnoe","html_url":"https://github.com/dnoe","followers_url":"https://api.github.com/users/dnoe/followers","following_url":"https://api.github.com/users/dnoe/following{/other_user}","gists_url":"https://api.github.com/users/dnoe/gists{/gist_id}","starred_url":"https://api.github.com/users/dnoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dnoe/subscriptions","organizations_url":"https://api.github.com/users/dnoe/orgs","repos_url":"https://api.github.com/users/dnoe/repos","events_url":"https://api.github.com/users/dnoe/events{/privacy}","received_events_url":"https://api.github.com/users/dnoe/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984/commits","review_comments_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984/comments","review_comment_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/1984/comments","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/33142cc584a2dc38e87988c5543a70c0096507eb","head":{"label":"PiotrSikora:sni_without_filter_chains","ref":"sni_without_filter_chains","sha":"33142cc584a2dc38e87988c5543a70c0096507eb","user":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"repo":{"id":70318420,"name":"envoy","full_name":"PiotrSikora/envoy","owner":{"login":"PiotrSikora","id":190297,"avatar_url":"https://avatars3.githubusercontent.com/u/190297?v=4","gravatar_id":"","url":"https://api.github.com/users/PiotrSikora","html_url":"https://github.com/PiotrSikora","followers_url":"https://api.github.com/users/PiotrSikora/followers","following_url":"https://api.github.com/users/PiotrSikora/following{/other_user}","gists_url":"https://api.github.com/users/PiotrSikora/gists{/gist_id}","starred_url":"https://api.github.com/users/PiotrSikora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PiotrSikora/subscriptions","organizations_url":"https://api.github.com/users/PiotrSikora/orgs","repos_url":"https://api.github.com/users/PiotrSikora/repos","events_url":"https://api.github.com/users/PiotrSikora/events{/privacy}","received_events_url":"https://api.github.com/users/PiotrSikora/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PiotrSikora/envoy","description":"C++ front/service proxy","fork":true,"url":"https://api.github.com/repos/PiotrSikora/envoy","forks_url":"https://api.github.com/repos/PiotrSikora/envoy/forks","keys_url":"https://api.github.com/repos/PiotrSikora/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PiotrSikora/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PiotrSikora/envoy/teams","hooks_url":"https://api.github.com/repos/PiotrSikora/envoy/hooks","issue_events_url":"https://api.github.com/repos/PiotrSikora/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/PiotrSikora/envoy/events","assignees_url":"https://api.github.com/repos/PiotrSikora/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/PiotrSikora/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/PiotrSikora/envoy/tags","blobs_url":"https://api.github.com/repos/PiotrSikora/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PiotrSikora/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PiotrSikora/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/PiotrSikora/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PiotrSikora/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/PiotrSikora/envoy/languages","stargazers_url":"https://api.github.com/repos/PiotrSikora/envoy/stargazers","contributors_url":"https://api.github.com/repos/PiotrSikora/envoy/contributors","subscribers_url":"https://api.github.com/repos/PiotrSikora/envoy/subscribers","subscription_url":"https://api.github.com/repos/PiotrSikora/envoy/subscription","commits_url":"https://api.github.com/repos/PiotrSikora/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/PiotrSikora/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/PiotrSikora/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/PiotrSikora/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/PiotrSikora/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/PiotrSikora/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PiotrSikora/envoy/merges","archive_url":"https://api.github.com/repos/PiotrSikora/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PiotrSikora/envoy/downloads","issues_url":"https://api.github.com/repos/PiotrSikora/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/PiotrSikora/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/PiotrSikora/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/PiotrSikora/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PiotrSikora/envoy/labels{/name}","releases_url":"https://api.github.com/repos/PiotrSikora/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/PiotrSikora/envoy/deployments","created_at":"2016-10-08T08:57:14Z","updated_at":"2016-10-08T08:57:16Z","pushed_at":"2017-11-07T09:12:19Z","git_url":"git://github.com/PiotrSikora/envoy.git","ssh_url":"git@github.com:PiotrSikora/envoy.git","clone_url":"https://github.com/PiotrSikora/envoy.git","svn_url":"https://github.com/PiotrSikora/envoy","homepage":"https://lyft.github.io/envoy","size":10899,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"envoyproxy:master","ref":"master","sha":"908ddde3adb0634c966d1170319b8c1f571dab95","user":{"login":"envoyproxy","id":30125649,"avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"repo":{"id":65214191,"name":"envoy","full_name":"envoyproxy/envoy","owner":{"login":"envoyproxy","id":30125649,"avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/envoyproxy/envoy","description":"C++ front/service proxy","fork":false,"url":"https://api.github.com/repos/envoyproxy/envoy","forks_url":"https://api.github.com/repos/envoyproxy/envoy/forks","keys_url":"https://api.github.com/repos/envoyproxy/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/envoyproxy/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/envoyproxy/envoy/teams","hooks_url":"https://api.github.com/repos/envoyproxy/envoy/hooks","issue_events_url":"https://api.github.com/repos/envoyproxy/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/envoyproxy/envoy/events","assignees_url":"https://api.github.com/repos/envoyproxy/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/envoyproxy/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/envoyproxy/envoy/tags","blobs_url":"https://api.github.com/repos/envoyproxy/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/envoyproxy/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/envoyproxy/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/envoyproxy/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/envoyproxy/envoy/languages","stargazers_url":"https://api.github.com/repos/envoyproxy/envoy/stargazers","contributors_url":"https://api.github.com/repos/envoyproxy/envoy/contributors","subscribers_url":"https://api.github.com/repos/envoyproxy/envoy/subscribers","subscription_url":"https://api.github.com/repos/envoyproxy/envoy/subscription","commits_url":"https://api.github.com/repos/envoyproxy/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/envoyproxy/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/envoyproxy/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/envoyproxy/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/envoyproxy/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/envoyproxy/envoy/merges","archive_url":"https://api.github.com/repos/envoyproxy/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/envoyproxy/envoy/downloads","issues_url":"https://api.github.com/repos/envoyproxy/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/envoyproxy/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/envoyproxy/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/envoyproxy/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/envoyproxy/envoy/labels{/name}","releases_url":"https://api.github.com/repos/envoyproxy/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/envoyproxy/envoy/deployments","created_at":"2016-08-08T15:07:24Z","updated_at":"2017-11-07T06:23:15Z","pushed_at":"2017-11-07T09:12:21Z","git_url":"git://github.com/envoyproxy/envoy.git","ssh_url":"git@github.com:envoyproxy/envoy.git","clone_url":"https://github.com/envoyproxy/envoy.git","svn_url":"https://github.com/envoyproxy/envoy","homepage":"https://envoyproxy.github.io/","size":50389,"stargazers_count":2839,"watchers_count":2839,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":326,"mirror_url":null,"archived":false,"open_issues_count":175,"forks":326,"open_issues":175,"watchers":2839,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/1984"},"issue":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/1984"},"comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/1984/comments"},"review_comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984/comments"},"review_comment":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/1984/commits"},"statuses":{"href":"https://api.github.com/repos/envoyproxy/envoy/statuses/33142cc584a2dc38e87988c5543a70c0096507eb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"PiotrSikora"}}