GitHub PullRequestReviewCommentEvent at 2014-10-17 21:37:14
Repository: netty
Actor: Scottmitch
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/netty/netty/pulls/comments/19044997","id":19044997,"diff_hunk":"@@ -0,0 +1,122 @@\n+/*\n+ * Copyright 2014 The Netty Project\n+ *\n+ * The Netty Project licenses this file to you under the Apache License,\n+ * version 2.0 (the \"License\"); you may not use this file except in compliance\n+ * with the License. You may obtain a copy of the License at:\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+ * License for the specific language governing permissions and limitations\n+ * under the License.\n+ */\n+package io.netty.handler.ssl;\n+\n+import java.util.List;\n+import java.util.Set;\n+\n+import javax.net.ssl.SSLEngine;\n+\n+/**\n+ * Interface to support Application Protocol Negotiation.\n+ * <p>\n+ * Default implementations are provided for:\n+ * <ul>\n+ * <li><a href=\"https://technotes.googlecode.com/git/nextprotoneg.html\">Next Protocol Negotiation</a></li>\n+ * <li><a href=\"http://tools.ietf.org/html/rfc7301\">Application-Layer Protocol Negotiation</a></li>\n+ * </ul>\n+ */\n+public interface ApplicationProtocolNegotiator {\n+    /**\n+     * Interface which provides a means to notify subscribers that the peer does not support this\n+     * {@link ApplicationProtocolNegotiator}.\n+     */\n+    public interface UnsupportedListener {\n+        /**\n+         * Callback invoked to let the application know that the peer does not support this\n+         * {@link ApplicationProtocolNegotiator}.\n+         */\n+        void unsupported();\n+    }\n+\n+    /**\n+     * Interface to define the role of an application protocol selector in the SSL handshake process. Either\n+     * {@link ProtocolSelector#unsupported()} OR {@link ProtocolSelector#select(List)}\n+     * will be called for each SSL handshake.\n+     */\n+    public interface ProtocolSelector extends UnsupportedListener {\n+        /**\n+         * Callback invoked to select the application level protocol from the {@code protocols} provided\n+         *\n+         * @param protocols the protocols sent by the protocol advertiser\n+         * @return the protocol selected by this {@link ProtocolSelector}. A {@code null} value will indicate the no\n+         * protocols were selected but the handshake should not fail. The decision to fail the handshake is left to the\n+         * other end negotiating the SSL handshake.\n+         * @throws Throwable If the {@code protocols} provide warrant failing the SSL handshake with a fatal alert.\n+         */\n+        String select(List<String> protocols);\n+    }\n+\n+    /**\n+     * A listener to be notified by which protocol was select by its peer.\n+     * Either the {@link ProtocolSelectionListener#unsupported()} OR\n+     * the {@link ProtocolSelectionListener#selected(String)} method will be called for each SSL handshake.\n+     */\n+    public interface ProtocolSelectionListener extends UnsupportedListener {\n+        /**\n+         * Callback invoked to let this application know the protocol chosen by the peer.\n+         *\n+         * @param protocol the protocol selected by the peer. May be {@code null} or empty as supported by the\n+         * application negotiation protocol.\n+         * @throws Throwable This may be thrown if the selected protocol is not acceptable and the desired behavior\n+         * is to fail the handshake with a fatal alert.\n+         */\n+        void selected(String protocol);\n+    }\n+\n+    /**\n+     * Factory interface for {@link ProtocolSelector} objects\n+     */\n+    public interface ProtocolSelectorFactory {\n+        /**\n+         * Generate a new instance of {@link ProtocolSelector}\n+         * @param engine The {@link SSLEngine} that the returned {@link ProtocolSelector} will be used to create an\n+         * instance for.\n+         * @param supportedProtocols The protocols that are supported\n+         * @return A new instance of {@link ProtocolSelector}\n+         */\n+        ProtocolSelector newSelector(SSLEngine engine, Set<String> supportedProtocols);\n+    }\n+\n+    /**\n+     * Factory interface for {@link ProtocolSelectionListener} objects\n+     */\n+    public interface ProtocolSelectionListenerFactory {\n+        /**\n+         * Generate a new instance of {@link ProtocolSelectionListener}\n+         * @param engine The {@link SSLEngine} that the returned {@link ProtocolSelectionListener}\n+         * will be used to create an instance for.\n+         * @param supportedProtocols The protocols that are supported in preference order\n+         * @return A new instance of {@link ProtocolSelectionListener}\n+         */\n+        ProtocolSelectionListener newListener(SSLEngine engine, List<String> supportedProtocols);\n+    }\n+\n+    /**\n+     * Get the collection of application protocols supported by this application (in preference order).\n+     */\n+    List<String> protocols();\n+\n+    /**\n+     * Get the {@link ProtocolSelectorFactory}\n+     */\n+    ProtocolSelectorFactory protocolSelectorFactory();","path":"handler/src/main/java/io/netty/handler/ssl/ApplicationProtocolNegotiator.java","position":116,"original_position":116,"commit_id":"07979ade4d99f8150381dabb96e81c9b08587d8b","original_commit_id":"07979ade4d99f8150381dabb96e81c9b08587d8b","user":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=2","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"body":"The only thing I have in the back of my mind is that what if OpenSSL needs more flexibility (like to be able to provide a subclass of the factory).  I guess we could cross that bridge when we get to it?","created_at":"2014-10-17T21:37:14Z","updated_at":"2014-10-17T21:37:14Z","html_url":"https://github.com/netty/netty/pull/2966#discussion_r19044997","pull_request_url":"https://api.github.com/repos/netty/netty/pulls/2966","_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/comments/19044997"},"html":{"href":"https://github.com/netty/netty/pull/2966#discussion_r19044997"},"pull_request":{"href":"https://api.github.com/repos/netty/netty/pulls/2966"}}},"pull_request":{"url":"https://api.github.com/repos/netty/netty/pulls/2966","id":22233443,"html_url":"https://github.com/netty/netty/pull/2966","diff_url":"https://github.com/netty/netty/pull/2966.diff","patch_url":"https://github.com/netty/netty/pull/2966.patch","issue_url":"https://api.github.com/repos/netty/netty/issues/2966","number":2966,"state":"open","locked":false,"title":"ALPN / NPN need to handle no compatible protocols found","user":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=2","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"body":"Motivation:\r\nIf there are no common protocols in the ALPN protocol exchange we still compete the handshake successfully.  This handshake should fail according to http://tools.ietf.org/html/rfc7301#section-3.2 with a status of no_application_protocol.\r\n\r\nModifications:\r\n-Upstream project used for ALPN (alpn-boot) does not support this.  So a PR https://github.com/jetty-project/jetty-alpn/pull/3 was submitted.\r\n-The netty code using alpn-boot should support the new interface (return null on existing method).\r\n-Version number of alpn-boot must be updated in pom.xml files\r\n\r\nResult:\r\n-Netty fails the SSL handshake if ALPN is used and there are no common protocols.","created_at":"2014-10-03T22:16:40Z","updated_at":"2014-10-17T21:37:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"797e679b8cbefb0a79e2135a3a7cbf573483ee2e","assignee":{"login":"Scottmitch","id":7562868,"avatar_url":"https://avatars.githubusercontent.com/u/7562868?v=2","gravatar_id":"","url":"https://api.github.com/users/Scottmitch","html_url":"https://github.com/Scottmitch","followers_url":"https://api.github.com/users/Scottmitch/followers","following_url":"https://api.github.com/users/Scottmitch/following{/other_user}","gists_url":"https://api.github.com/users/Scottmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/Scottmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Scottmitch/subscriptions","organizations_url":"https://api.github.com/users/Scottmitch/orgs","repos_url":"https://api.github.com/users/Scottmitch/repos","events_url":"https://api.github.com/users/Scottmitch/events{/privacy}","received_events_url":"https://api.github.com/users/Scottmitch/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/netty/netty/milestones/80","labels_url":"https://api.github.com/repos/netty/netty/milestones/80/labels","id":504488,"number":80,"title":"5.0.0.Alpha2","description":"","creator":{"login":"normanmaurer","id":439362,"avatar_url":"https://avatars.githubusercontent.com/u/439362?v=2","gravatar_id":"","url":"https://api.github.com/users/normanmaurer","html_url":"https://github.com/normanmaurer","followers_url":"https://api.github.com/users/normanmaurer/followers","following_url":"https://api.github.com/users/normanmaurer/following{/other_user}","gists_url":"https://api.github.com/users/normanmaurer/gists{/gist_id}","starred_url":"https://api.github.com/users/normanmaurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanmaurer/subscriptions","organizations_url":"https://api.github.com/users/normanmaurer/orgs","repos_url":"https://api.github.com/users/normanmaurer/repos","events_url":"https://api.github.com/users/normanmaurer/events{/privacy}","received_events_url":"https://api.github.com/users/normanmaurer/received_events","type":"User","site_admin":false},"open_issues":18,"closed_issues":101,"state":"open","created_at":"2013-12-04T06:57:47Z","updated_at":"2014-10-17T11:53:08Z","due_on":null},"commits_url":"https://api.github.com/repos/netty/netty/pulls/2966/commits","review_comments_url":"https://api.github.com/repos/netty/netty/pulls/2966/comments","review_comment_url":"https://api.github.com/repos/netty/netty/pulls/comments/{number}","comments_url":"https://api.github.com/repos/netty/netty/issues/2966/comments","statuses_url":"https://api.github.com/repos/netty/netty/statuses/07979ade4d99f8150381dabb96e81c9b08587d8b","head":{"label":"akamai:alpn_fail_handshake","ref":"alpn_fail_handshake","sha":"07979ade4d99f8150381dabb96e81c9b08587d8b","user":{"login":"akamai","id":7504551,"avatar_url":"https://avatars.githubusercontent.com/u/7504551?v=2","gravatar_id":"","url":"https://api.github.com/users/akamai","html_url":"https://github.com/akamai","followers_url":"https://api.github.com/users/akamai/followers","following_url":"https://api.github.com/users/akamai/following{/other_user}","gists_url":"https://api.github.com/users/akamai/gists{/gist_id}","starred_url":"https://api.github.com/users/akamai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akamai/subscriptions","organizations_url":"https://api.github.com/users/akamai/orgs","repos_url":"https://api.github.com/users/akamai/repos","events_url":"https://api.github.com/users/akamai/events{/privacy}","received_events_url":"https://api.github.com/users/akamai/received_events","type":"Organization","site_admin":false},"repo":{"id":22530159,"name":"netty","full_name":"akamai/netty","owner":{"login":"akamai","id":7504551,"avatar_url":"https://avatars.githubusercontent.com/u/7504551?v=2","gravatar_id":"","url":"https://api.github.com/users/akamai","html_url":"https://github.com/akamai","followers_url":"https://api.github.com/users/akamai/followers","following_url":"https://api.github.com/users/akamai/following{/other_user}","gists_url":"https://api.github.com/users/akamai/gists{/gist_id}","starred_url":"https://api.github.com/users/akamai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akamai/subscriptions","organizations_url":"https://api.github.com/users/akamai/orgs","repos_url":"https://api.github.com/users/akamai/repos","events_url":"https://api.github.com/users/akamai/events{/privacy}","received_events_url":"https://api.github.com/users/akamai/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akamai/netty","description":"Netty project - an event-driven asynchronous network application framework","fork":true,"url":"https://api.github.com/repos/akamai/netty","forks_url":"https://api.github.com/repos/akamai/netty/forks","keys_url":"https://api.github.com/repos/akamai/netty/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akamai/netty/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akamai/netty/teams","hooks_url":"https://api.github.com/repos/akamai/netty/hooks","issue_events_url":"https://api.github.com/repos/akamai/netty/issues/events{/number}","events_url":"https://api.github.com/repos/akamai/netty/events","assignees_url":"https://api.github.com/repos/akamai/netty/assignees{/user}","branches_url":"https://api.github.com/repos/akamai/netty/branches{/branch}","tags_url":"https://api.github.com/repos/akamai/netty/tags","blobs_url":"https://api.github.com/repos/akamai/netty/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akamai/netty/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akamai/netty/git/refs{/sha}","trees_url":"https://api.github.com/repos/akamai/netty/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akamai/netty/statuses/{sha}","languages_url":"https://api.github.com/repos/akamai/netty/languages","stargazers_url":"https://api.github.com/repos/akamai/netty/stargazers","contributors_url":"https://api.github.com/repos/akamai/netty/contributors","subscribers_url":"https://api.github.com/repos/akamai/netty/subscribers","subscription_url":"https://api.github.com/repos/akamai/netty/subscription","commits_url":"https://api.github.com/repos/akamai/netty/commits{/sha}","git_commits_url":"https://api.github.com/repos/akamai/netty/git/commits{/sha}","comments_url":"https://api.github.com/repos/akamai/netty/comments{/number}","issue_comment_url":"https://api.github.com/repos/akamai/netty/issues/comments/{number}","contents_url":"https://api.github.com/repos/akamai/netty/contents/{+path}","compare_url":"https://api.github.com/repos/akamai/netty/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akamai/netty/merges","archive_url":"https://api.github.com/repos/akamai/netty/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akamai/netty/downloads","issues_url":"https://api.github.com/repos/akamai/netty/issues{/number}","pulls_url":"https://api.github.com/repos/akamai/netty/pulls{/number}","milestones_url":"https://api.github.com/repos/akamai/netty/milestones{/number}","notifications_url":"https://api.github.com/repos/akamai/netty/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akamai/netty/labels{/name}","releases_url":"https://api.github.com/repos/akamai/netty/releases{/id}","created_at":"2014-08-01T21:49:13Z","updated_at":"2014-08-15T17:45:13Z","pushed_at":"2014-10-17T19:03:22Z","git_url":"git://github.com/akamai/netty.git","ssh_url":"git@github.com:akamai/netty.git","clone_url":"https://github.com/akamai/netty.git","svn_url":"https://github.com/akamai/netty","homepage":"http://netty.io/","size":37294,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"netty:master","ref":"master","sha":"e809f97136f86413d4fce4d6e259a82aa174353e","user":{"login":"netty","id":473791,"avatar_url":"https://avatars.githubusercontent.com/u/473791?v=2","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=2","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}","created_at":"2010-11-09T09:22:21Z","updated_at":"2014-10-17T20:18:09Z","pushed_at":"2014-10-17T11:53:09Z","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":118808,"stargazers_count":3627,"watchers_count":3627,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1724,"mirror_url":null,"open_issues_count":170,"forks":1724,"open_issues":170,"watchers":3627,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/netty/netty/pulls/2966"},"html":{"href":"https://github.com/netty/netty/pull/2966"},"issue":{"href":"https://api.github.com/repos/netty/netty/issues/2966"},"comments":{"href":"https://api.github.com/repos/netty/netty/issues/2966/comments"},"review_comments":{"href":"https://api.github.com/repos/netty/netty/pulls/2966/comments"},"review_comment":{"href":"https://api.github.com/repos/netty/netty/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/netty/netty/pulls/2966/commits"},"statuses":{"href":"https://api.github.com/repos/netty/netty/statuses/07979ade4d99f8150381dabb96e81c9b08587d8b"}}}}