{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/86518718","pull_request_review_id":7172366,"id":86518718,"diff_hunk":"@@ -0,0 +1,67 @@\n+'use strict';\n+var assert = require('assert');\n+var common = require('../common');\n+\n+if (!common.hasCrypto) {\n+  common.skip('missing crypto');\n+  return;\n+}\n+\n+var https = require('https');\n+var fs = require('fs');\n+\n+var options = {\n+  key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),\n+  cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'),\n+  ca:  fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem')\n+};\n+\n+\n+var server = https.Server(options, function(req, res) {\n+  res.writeHead(200);\n+  res.end('hello world\\n');\n+});\n+\n+server.listen(0, function() {\n+  const port = this.address().port;\n+  var globalAgent = https.globalAgent;\n+  globalAgent.keepAlive = true;\n+  https.get({\n+    path: '/',\n+    port: port,\n+    ca: options.ca,\n+    rejectUnauthorized: true,\n+    servername: 'agent1',\n+    secureProtocol: 'SSLv23_method'\n+  }, function(res) {\n+    res.resume();\n+    globalAgent.once('free', function () {\n+      https.get({\n+        path: '/',\n+        port: port,\n+        ca: options.ca,\n+        rejectUnauthorized: true,\n+        servername: 'agent1',\n+        secureProtocol: 'TLSv1_method'\n+      }, function(res) {\n+        res.resume();\n+        globalAgent.once('free', function () {\n+          // Verify that two keep-alived connections are created\n+          // due to the different secureProtocol settings:\n+          var keys = Object.keys(globalAgent.freeSockets);\n+          assert.equal(keys.length, 2);\n+          assert.notEqual(keys[0].indexOf(':SSLv23_method'), -1);\n+          assert.notEqual(keys[1].indexOf(':TLSv1_method'), -1);\n+          globalAgent.destroy();\n+          server.close();\n+        });\n+      }).on('error', function(e) {\n+        console.log(e.message);\n+        process.exit(1);","path":"test/parallel/test-https-agent-secure-protocol.js","position":60,"original_position":60,"commit_id":"2cc652cef031021f97b12ff02b5d22d25b4ee9a4","original_commit_id":"2cc652cef031021f97b12ff02b5d22d25b4ee9a4","user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"body":"Don't do this, just let the exception bubble up.","created_at":"2016-11-04T10:21:11Z","updated_at":"2016-11-04T10:21:59Z","html_url":"https://github.com/nodejs/node/pull/9452#discussion_r86518718","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/9452","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/86518718"},"html":{"href":"https://github.com/nodejs/node/pull/9452#discussion_r86518718"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/9452"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/9452","id":92250804,"html_url":"https://github.com/nodejs/node/pull/9452","diff_url":"https://github.com/nodejs/node/pull/9452.diff","patch_url":"https://github.com/nodejs/node/pull/9452.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/9452","number":9452,"state":"open","locked":false,"title":"https: Use secureProtocol in Agent#getName","user":{"login":"papandreou","id":373545,"avatar_url":"https://avatars.githubusercontent.com/u/373545?v=3","gravatar_id":"","url":"https://api.github.com/users/papandreou","html_url":"https://github.com/papandreou","followers_url":"https://api.github.com/users/papandreou/followers","following_url":"https://api.github.com/users/papandreou/following{/other_user}","gists_url":"https://api.github.com/users/papandreou/gists{/gist_id}","starred_url":"https://api.github.com/users/papandreou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/papandreou/subscriptions","organizations_url":"https://api.github.com/users/papandreou/orgs","repos_url":"https://api.github.com/users/papandreou/repos","events_url":"https://api.github.com/users/papandreou/events{/privacy}","received_events_url":"https://api.github.com/users/papandreou/received_events","type":"User","site_admin":false},"body":"##### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] `make -j8 test` (UNIX), or `vcbuild test nosign` (Windows) passes\r\n- [x] tests and/or benchmarks are included\r\n- [ ] documentation is changed or added\r\n- [x] commit message follows commit guidelines\r\n\r\n##### Affected core subsystem(s)\r\n\r\nhttps\r\n\r\n##### Description of change\r\n\r\nFix oversight pointed out by @bnoordhuis in #9324. The value of the `secureProtocol` option should be used as a \"discriminator\" when determining whether an existing HTTPS connection can be reused.","created_at":"2016-11-03T22:11:46Z","updated_at":"2016-11-04T10:21:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f433afd5acb78e4e1bc5360b09ab4dee43dd122","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/9452/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/9452/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/9452/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/2cc652cef031021f97b12ff02b5d22d25b4ee9a4","head":{"label":"assetgraph:fix/agentWithSecureProtocol","ref":"fix/agentWithSecureProtocol","sha":"2cc652cef031021f97b12ff02b5d22d25b4ee9a4","user":{"login":"assetgraph","id":6302962,"avatar_url":"https://avatars.githubusercontent.com/u/6302962?v=3","gravatar_id":"","url":"https://api.github.com/users/assetgraph","html_url":"https://github.com/assetgraph","followers_url":"https://api.github.com/users/assetgraph/followers","following_url":"https://api.github.com/users/assetgraph/following{/other_user}","gists_url":"https://api.github.com/users/assetgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/assetgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assetgraph/subscriptions","organizations_url":"https://api.github.com/users/assetgraph/orgs","repos_url":"https://api.github.com/users/assetgraph/repos","events_url":"https://api.github.com/users/assetgraph/events{/privacy}","received_events_url":"https://api.github.com/users/assetgraph/received_events","type":"Organization","site_admin":false},"repo":{"id":64035270,"name":"node","full_name":"assetgraph/node","owner":{"login":"assetgraph","id":6302962,"avatar_url":"https://avatars.githubusercontent.com/u/6302962?v=3","gravatar_id":"","url":"https://api.github.com/users/assetgraph","html_url":"https://github.com/assetgraph","followers_url":"https://api.github.com/users/assetgraph/followers","following_url":"https://api.github.com/users/assetgraph/following{/other_user}","gists_url":"https://api.github.com/users/assetgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/assetgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assetgraph/subscriptions","organizations_url":"https://api.github.com/users/assetgraph/orgs","repos_url":"https://api.github.com/users/assetgraph/repos","events_url":"https://api.github.com/users/assetgraph/events{/privacy}","received_events_url":"https://api.github.com/users/assetgraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/assetgraph/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/assetgraph/node","forks_url":"https://api.github.com/repos/assetgraph/node/forks","keys_url":"https://api.github.com/repos/assetgraph/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/assetgraph/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/assetgraph/node/teams","hooks_url":"https://api.github.com/repos/assetgraph/node/hooks","issue_events_url":"https://api.github.com/repos/assetgraph/node/issues/events{/number}","events_url":"https://api.github.com/repos/assetgraph/node/events","assignees_url":"https://api.github.com/repos/assetgraph/node/assignees{/user}","branches_url":"https://api.github.com/repos/assetgraph/node/branches{/branch}","tags_url":"https://api.github.com/repos/assetgraph/node/tags","blobs_url":"https://api.github.com/repos/assetgraph/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/assetgraph/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/assetgraph/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/assetgraph/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/assetgraph/node/statuses/{sha}","languages_url":"https://api.github.com/repos/assetgraph/node/languages","stargazers_url":"https://api.github.com/repos/assetgraph/node/stargazers","contributors_url":"https://api.github.com/repos/assetgraph/node/contributors","subscribers_url":"https://api.github.com/repos/assetgraph/node/subscribers","subscription_url":"https://api.github.com/repos/assetgraph/node/subscription","commits_url":"https://api.github.com/repos/assetgraph/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/assetgraph/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/assetgraph/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/assetgraph/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/assetgraph/node/contents/{+path}","compare_url":"https://api.github.com/repos/assetgraph/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/assetgraph/node/merges","archive_url":"https://api.github.com/repos/assetgraph/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/assetgraph/node/downloads","issues_url":"https://api.github.com/repos/assetgraph/node/issues{/number}","pulls_url":"https://api.github.com/repos/assetgraph/node/pulls{/number}","milestones_url":"https://api.github.com/repos/assetgraph/node/milestones{/number}","notifications_url":"https://api.github.com/repos/assetgraph/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/assetgraph/node/labels{/name}","releases_url":"https://api.github.com/repos/assetgraph/node/releases{/id}","deployments_url":"https://api.github.com/repos/assetgraph/node/deployments","created_at":"2016-07-23T20:38:44Z","updated_at":"2016-07-23T20:40:47Z","pushed_at":"2016-11-03T22:07:23Z","git_url":"git://github.com/assetgraph/node.git","ssh_url":"git@github.com:assetgraph/node.git","clone_url":"https://github.com/assetgraph/node.git","svn_url":"https://github.com/assetgraph/node","homepage":"https://nodejs.org","size":240611,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"nodejs:master","ref":"master","sha":"5cbb7a887a7ddb737252ecf60fbebc2005af090c","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-11-04T10:17:17Z","pushed_at":"2016-11-04T10:21:39Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":358385,"stargazers_count":28600,"watchers_count":28600,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4760,"mirror_url":null,"open_issues_count":883,"forks":4760,"open_issues":883,"watchers":28600,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/9452"},"html":{"href":"https://github.com/nodejs/node/pull/9452"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/9452"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/9452/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/9452/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/9452/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/2cc652cef031021f97b12ff02b5d22d25b4ee9a4"}}}}
{"actor":{"display_login":"bnoordhuis"}}