{"action":"created","comment":{"url":"https://api.github.com/repos/netty/netty/pulls/comments/77220699","id":77220699,"diff_hunk":"@@ -306,6 +306,16 @@ public void operationComplete(Future<SslContext> future) throws Exception {\n     }\n \n     /**\n+     * The default implementation will simply call {@link AsyncMapping#map(Object, Promise)} but\n+     * users can override this method to implement custom behavior.\n+     *\n+     * @see AsyncMapping#map(Object, Promise)\n+     */\n+    protected Future<SslContext> lookup(ChannelHandlerContext ctx, String hostname) throws Exception {","path":"handler/src/main/java/io/netty/handler/ssl/SniHandler.java","position":29,"original_position":20,"commit_id":"9c19b3954a87ff6a9e28822e7a38bb1ce591818e","original_commit_id":"a650a9913a860a69b27f50cc83e7146e59ac632d","user":{"login":"rkapsi","id":191635,"avatar_url":"https://avatars.githubusercontent.com/u/191635?v=3","gravatar_id":"","url":"https://api.github.com/users/rkapsi","html_url":"https://github.com/rkapsi","followers_url":"https://api.github.com/users/rkapsi/followers","following_url":"https://api.github.com/users/rkapsi/following{/other_user}","gists_url":"https://api.github.com/users/rkapsi/gists{/gist_id}","starred_url":"https://api.github.com/users/rkapsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkapsi/subscriptions","organizations_url":"https://api.github.com/users/rkapsi/orgs","repos_url":"https://api.github.com/users/rkapsi/repos","events_url":"https://api.github.com/users/rkapsi/events{/privacy}","received_events_url":"https://api.github.com/users/rkapsi/received_events","type":"User","site_admin":false},"body":"Having it `protected` could be useful for something like this:\r\n\r\n```java\r\npublic class MyAsyncMapping implements AsyncMapping<String, SslContext> {\r\n\r\n  @Override\r\n  public Future<SslContext> map(String input, Promise<SslContext> promise) {\r\n    throw new UnsupportedOperationException();\r\n  }\r\n  \r\n  public Future<SslContext> lookup(ChannelHandlerContext ctx, String hostname) {\r\n    // ... do something ...\r\n  }\r\n}\r\n\r\npublic class MySniHandler extends SniHandler {\r\n  \r\n  public MySniHandler(AsyncMapping<String, SslContext> mapper) {\r\n    super(mapper);\r\n  }\r\n  \r\n  @Override\r\n  public Future<SslContext> lookup(ChannelHandlerContext ctx, String hostname) {\r\n    return ((MyAsyncMapping)mapping).lookup(ctx, hostname);\r\n  }\r\n}\r\n```\r\n\r\nOn the other hand, the user has the opportunity to get a hold onto the Mapper via ctor if they need to. I think having it protected in this case would save one field.","created_at":"2016-09-01T17:47:17Z","updated_at":"2016-09-01T17:47:17Z","html_url":"https://github.com/netty/netty/pull/5786#discussion_r77220699","pull_request_url":"https://api.github.com/repos/netty/netty/pulls/5786","_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/comments/77220699"},"html":{"href":"https://github.com/netty/netty/pull/5786#discussion_r77220699"},"pull_request":{"href":"https://api.github.com/repos/netty/netty/pulls/5786"}}},"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/5786","id":83626203,"html_url":"https://github.com/netty/netty/pull/5786","diff_url":"https://github.com/netty/netty/pull/5786.diff","patch_url":"https://github.com/netty/netty/pull/5786.patch","issue_url":"https://api.github.com/repos/netty/netty/issues/5786","number":5786,"state":"open","locked":false,"title":"Expose the ChannelHandlerContext from SniHandler's select() step to t…","user":{"login":"rkapsi","id":191635,"avatar_url":"https://avatars.githubusercontent.com/u/191635?v=3","gravatar_id":"","url":"https://api.github.com/users/rkapsi","html_url":"https://github.com/rkapsi","followers_url":"https://api.github.com/users/rkapsi/followers","following_url":"https://api.github.com/users/rkapsi/following{/other_user}","gists_url":"https://api.github.com/users/rkapsi/gists{/gist_id}","starred_url":"https://api.github.com/users/rkapsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkapsi/subscriptions","organizations_url":"https://api.github.com/users/rkapsi/orgs","repos_url":"https://api.github.com/users/rkapsi/repos","events_url":"https://api.github.com/users/rkapsi/events{/privacy}","received_events_url":"https://api.github.com/users/rkapsi/received_events","type":"User","site_admin":false},"body":"…he user.\r\n\r\nMotivation\r\n\r\nI'm looking to harden our SSL impl. a little bit and add some guards agaist certain types of abuse. One can think of invalid hostname strings in the SNI extenstion or invalid SNI handshakes altogether. This will require measuring, velocity tracking and other things.\r\n\r\nModifications\r\n\r\nAdding a protected `lookup(ctx, hostname)` method that is called from SniHandler's `select(...)` method which users can override and implement custom behaviour. The default implementation will simply call the AsyncMapper.\r\n\r\nResult\r\n\r\nIt's possible to get a hold onto the ChannelHandlerContext. Users can override that method and do something with it right there or they can delegate it to something else. SniHandler is happy as long as a `Future<SslContext>` is being returned.","created_at":"2016-09-01T12:50:28Z","updated_at":"2016-09-01T17:47:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ae64647016c5a125c5178ee5ab0094764acc444","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/netty/netty/pulls/5786/commits","review_comments_url":"https://api.github.com/repos/netty/netty/pulls/5786/comments","review_comment_url":"https://api.github.com/repos/netty/netty/pulls/comments{/number}","comments_url":"https://api.github.com/repos/netty/netty/issues/5786/comments","statuses_url":"https://api.github.com/repos/netty/netty/statuses/9c19b3954a87ff6a9e28822e7a38bb1ce591818e","head":{"label":"Squarespace:rkapsi/expose-ctx-to-mapper","ref":"rkapsi/expose-ctx-to-mapper","sha":"9c19b3954a87ff6a9e28822e7a38bb1ce591818e","user":{"login":"Squarespace","id":722929,"avatar_url":"https://avatars.githubusercontent.com/u/722929?v=3","gravatar_id":"","url":"https://api.github.com/users/Squarespace","html_url":"https://github.com/Squarespace","followers_url":"https://api.github.com/users/Squarespace/followers","following_url":"https://api.github.com/users/Squarespace/following{/other_user}","gists_url":"https://api.github.com/users/Squarespace/gists{/gist_id}","starred_url":"https://api.github.com/users/Squarespace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Squarespace/subscriptions","organizations_url":"https://api.github.com/users/Squarespace/orgs","repos_url":"https://api.github.com/users/Squarespace/repos","events_url":"https://api.github.com/users/Squarespace/events{/privacy}","received_events_url":"https://api.github.com/users/Squarespace/received_events","type":"Organization","site_admin":false},"repo":{"id":40826270,"name":"netty","full_name":"Squarespace/netty","owner":{"login":"Squarespace","id":722929,"avatar_url":"https://avatars.githubusercontent.com/u/722929?v=3","gravatar_id":"","url":"https://api.github.com/users/Squarespace","html_url":"https://github.com/Squarespace","followers_url":"https://api.github.com/users/Squarespace/followers","following_url":"https://api.github.com/users/Squarespace/following{/other_user}","gists_url":"https://api.github.com/users/Squarespace/gists{/gist_id}","starred_url":"https://api.github.com/users/Squarespace/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Squarespace/subscriptions","organizations_url":"https://api.github.com/users/Squarespace/orgs","repos_url":"https://api.github.com/users/Squarespace/repos","events_url":"https://api.github.com/users/Squarespace/events{/privacy}","received_events_url":"https://api.github.com/users/Squarespace/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Squarespace/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":true,"url":"https://api.github.com/repos/Squarespace/netty","forks_url":"https://api.github.com/repos/Squarespace/netty/forks","keys_url":"https://api.github.com/repos/Squarespace/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Squarespace/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Squarespace/netty/teams","hooks_url":"https://api.github.com/repos/Squarespace/netty/hooks","issue_events_url":"https://api.github.com/repos/Squarespace/netty/issues/events{/number}","events_url":"https://api.github.com/repos/Squarespace/netty/events","assignees_url":"https://api.github.com/repos/Squarespace/netty/assignees{/user}","branches_url":"https://api.github.com/repos/Squarespace/netty/branches{/branch}","tags_url":"https://api.github.com/repos/Squarespace/netty/tags","blobs_url":"https://api.github.com/repos/Squarespace/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Squarespace/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Squarespace/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/Squarespace/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Squarespace/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/Squarespace/netty/languages","stargazers_url":"https://api.github.com/repos/Squarespace/netty/stargazers","contributors_url":"https://api.github.com/repos/Squarespace/netty/contributors","subscribers_url":"https://api.github.com/repos/Squarespace/netty/subscribers","subscription_url":"https://api.github.com/repos/Squarespace/netty/subscription","commits_url":"https://api.github.com/repos/Squarespace/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/Squarespace/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/Squarespace/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/Squarespace/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/Squarespace/netty/contents/{+path}","compare_url":"https://api.github.com/repos/Squarespace/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Squarespace/netty/merges","archive_url":"https://api.github.com/repos/Squarespace/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Squarespace/netty/downloads","issues_url":"https://api.github.com/repos/Squarespace/netty/issues{/number}","pulls_url":"https://api.github.com/repos/Squarespace/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/Squarespace/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/Squarespace/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Squarespace/netty/labels{/name}","releases_url":"https://api.github.com/repos/Squarespace/netty/releases{/id}","deployments_url":"https://api.github.com/repos/Squarespace/netty/deployments","created_at":"2015-08-16T15:30:20Z","updated_at":"2016-08-29T20:47:51Z","pushed_at":"2016-09-01T13:23:29Z","git_url":"git://github.com/Squarespace/netty.git","ssh_url":"git@github.com:Squarespace/netty.git","clone_url":"https://github.com/Squarespace/netty.git","svn_url":"https://github.com/Squarespace/netty","homepage":"http://netty.io/","size":39343,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":0,"default_branch":"4.1"}},"base":{"label":"netty:4.1","ref":"4.1","sha":"30fe2e868fcc99d24046e505f9406067ba6e9d07","user":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=3","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"repo":{"id":1064563,"name":"netty","full_name":"netty/netty","owner":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=3","gravatar_id":"","url":"https://api.github.com/users/netty","html_url":"https://github.com/netty","followers_url":"https://api.github.com/users/netty/followers","following_url":"https://api.github.com/users/netty/following{/other_user}","gists_url":"https://api.github.com/users/netty/gists{/gist_id}","starred_url":"https://api.github.com/users/netty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/netty/subscriptions","organizations_url":"https://api.github.com/users/netty/orgs","repos_url":"https://api.github.com/users/netty/repos","events_url":"https://api.github.com/users/netty/events{/privacy}","received_events_url":"https://api.github.com/users/netty/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/netty/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":false,"url":"https://api.github.com/repos/netty/netty","forks_url":"https://api.github.com/repos/netty/netty/forks","keys_url":"https://api.github.com/repos/netty/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/netty/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/netty/netty/teams","hooks_url":"https://api.github.com/repos/netty/netty/hooks","issue_events_url":"https://api.github.com/repos/netty/netty/issues/events{/number}","events_url":"https://api.github.com/repos/netty/netty/events","assignees_url":"https://api.github.com/repos/netty/netty/assignees{/user}","branches_url":"https://api.github.com/repos/netty/netty/branches{/branch}","tags_url":"https://api.github.com/repos/netty/netty/tags","blobs_url":"https://api.github.com/repos/netty/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/netty/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/netty/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/netty/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/netty/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/netty/netty/languages","stargazers_url":"https://api.github.com/repos/netty/netty/stargazers","contributors_url":"https://api.github.com/repos/netty/netty/contributors","subscribers_url":"https://api.github.com/repos/netty/netty/subscribers","subscription_url":"https://api.github.com/repos/netty/netty/subscription","commits_url":"https://api.github.com/repos/netty/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/netty/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/netty/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/netty/netty/issues/comments{/number}","contents_url":"https://api.github.com/repos/netty/netty/contents/{+path}","compare_url":"https://api.github.com/repos/netty/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/netty/netty/merges","archive_url":"https://api.github.com/repos/netty/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/netty/netty/downloads","issues_url":"https://api.github.com/repos/netty/netty/issues{/number}","pulls_url":"https://api.github.com/repos/netty/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/netty/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/netty/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/netty/netty/labels{/name}","releases_url":"https://api.github.com/repos/netty/netty/releases{/id}","deployments_url":"https://api.github.com/repos/netty/netty/deployments","created_at":"2010-11-09T09:22:21Z","updated_at":"2016-09-01T12:38:58Z","pushed_at":"2016-09-01T17:43:52Z","git_url":"git://github.com/netty/netty.git","ssh_url":"git@github.com:netty/netty.git","clone_url":"https://github.com/netty/netty.git","svn_url":"https://github.com/netty/netty","homepage":"http://netty.io/","size":71352,"stargazers_count":7709,"watchers_count":7709,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3914,"mirror_url":null,"open_issues_count":348,"forks":3914,"open_issues":348,"watchers":7709,"default_branch":"4.1"}},"_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/5786"},"html":{"href":"https://github.com/netty/netty/pull/5786"},"issue":{"href":"https://api.github.com/repos/netty/netty/issues/5786"},"comments":{"href":"https://api.github.com/repos/netty/netty/issues/5786/comments"},"review_comments":{"href":"https://api.github.com/repos/netty/netty/pulls/5786/comments"},"review_comment":{"href":"https://api.github.com/repos/netty/netty/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/netty/netty/pulls/5786/commits"},"statuses":{"href":"https://api.github.com/repos/netty/netty/statuses/9c19b3954a87ff6a9e28822e7a38bb1ce591818e"}}}}
{"actor":{"display_login":"rkapsi"}}