{"action":"created","comment":{"url":"https://api.github.com/repos/request/request/pulls/comments/22841372","id":22841372,"diff_hunk":"@@ -0,0 +1,83 @@\n+'use strict'\n+\n+function formatHostname(hostname) {\n+  // canonicalize the hostname, so that 'oogle.com' won't match 'google.com'\n+  return hostname.replace(/^\\.*/, '.').toLowerCase()\n+}\n+\n+function noProxyZoneObject(zone) {\n+  zone = zone.trim().toLowerCase()\n+\n+  var zoneParts = zone.split(':', 2)\n+    , zoneHost = formatHostname(zoneParts[0])\n+    , zonePort = zoneParts[1]\n+    , hasPort = zone.indexOf(':') > -1\n+\n+  return {hostname: zoneHost, port: zonePort, hasPort: hasPort}\n+}\n+\n+function uriInNoProxy(uri, noProxy) {\n+  var port = uri.port || (uri.protocol === 'https:' ? '443' : '80')\n+    , hostname = formatHostname(uri.hostname)\n+    , noProxyList = noProxy.split(',')\n+\n+  // iterate through the noProxyList until it finds a match.\n+  return noProxyList.some(function(zone) {\n+    var noProxyZone = noProxyZoneObject(zone)\n+      , isMatchedAt = hostname.indexOf(noProxyZone.hostname)\n+      , hostnameMatched = (\n+          isMatchedAt > -1 &&\n+          (isMatchedAt === hostname.length - noProxyZone.hostname.length)\n+        )\n+\n+    if(noProxyZone.hasPort) {\n+      return (port === noProxyZone.port) && hostnameMatched\n+    }\n+\n+    return hostnameMatched\n+  })\n+}\n+\n+function getProxyFromURI(uri) {\n+  // Decide the proper request proxy to use based on the request URI object and the\n+  // environmental variables (NO_PROXY, HTTP_PROXY, etc.)\n+  // respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html)\n+\n+  var noProxy = process.env.NO_PROXY || process.env.no_proxy || ''\n+    , noProxyIsWildCard = noProxy === '*'\n+    , noProxyIsNotEmpty = noProxy !== ''\n+\n+  // if the noProxy is a wildcard then return null\n+\n+  if(noProxyIsWildCard) {\n+    return null\n+  }\n+  \n+  // if the noProxy is not empty and the uri is found return null\n+\n+  if (noProxyIsNotEmpty && uriInNoProxy(uri, noProxy)) {\n+    return null\n+  }\n+\n+  // Check for HTTP or HTTPS Proxy in environment Else default to null\n+\n+  if (uri.protocol === 'http:') {\n+    return process.env.HTTP_PROXY ||\n+           process.env.http_proxy ||\n+           null\n+  }\n+  \n+  if (uri.protocol === 'https:') {\n+    return process.env.HTTPS_PROXY ||\n+           process.env.https_proxy ||\n+           process.env.HTTP_PROXY  ||\n+           process.env.http_proxy  || null\n+  }","path":"lib/getProxyFromURI.js","position":75,"original_position":75,"commit_id":"81552c549c40e5bd22b96885325b75ed83cf93b5","original_commit_id":"81552c549c40e5bd22b96885325b75ed83cf93b5","user":{"login":"seanstrom","id":2845768,"avatar_url":"https://avatars.githubusercontent.com/u/2845768?v=3","gravatar_id":"","url":"https://api.github.com/users/seanstrom","html_url":"https://github.com/seanstrom","followers_url":"https://api.github.com/users/seanstrom/followers","following_url":"https://api.github.com/users/seanstrom/following{/other_user}","gists_url":"https://api.github.com/users/seanstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/seanstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanstrom/subscriptions","organizations_url":"https://api.github.com/users/seanstrom/orgs","repos_url":"https://api.github.com/users/seanstrom/repos","events_url":"https://api.github.com/users/seanstrom/events{/privacy}","received_events_url":"https://api.github.com/users/seanstrom/received_events","type":"User","site_admin":false},"body":"oops this was a typo aha, but it poses an interesting question.\r\nI kind of like the second one, so I'll make the other conform","created_at":"2015-01-13T03:19:29Z","updated_at":"2015-01-13T03:19:29Z","html_url":"https://github.com/request/request/pull/1346#discussion_r22841372","pull_request_url":"https://api.github.com/repos/request/request/pulls/1346","_links":{"self":{"href":"https://api.github.com/repos/request/request/pulls/comments/22841372"},"html":{"href":"https://github.com/request/request/pull/1346#discussion_r22841372"},"pull_request":{"href":"https://api.github.com/repos/request/request/pulls/1346"}}},"pull_request":{"url":"https://api.github.com/repos/request/request/pulls/1346","id":27078475,"html_url":"https://github.com/request/request/pull/1346","diff_url":"https://github.com/request/request/pull/1346.diff","patch_url":"https://github.com/request/request/pull/1346.patch","issue_url":"https://api.github.com/repos/request/request/issues/1346","number":1346,"state":"open","locked":false,"title":"getProxyFromURI Extraction Refactor","user":{"login":"seanstrom","id":2845768,"avatar_url":"https://avatars.githubusercontent.com/u/2845768?v=3","gravatar_id":"","url":"https://api.github.com/users/seanstrom","html_url":"https://github.com/seanstrom","followers_url":"https://api.github.com/users/seanstrom/followers","following_url":"https://api.github.com/users/seanstrom/following{/other_user}","gists_url":"https://api.github.com/users/seanstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/seanstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanstrom/subscriptions","organizations_url":"https://api.github.com/users/seanstrom/orgs","repos_url":"https://api.github.com/users/seanstrom/repos","events_url":"https://api.github.com/users/seanstrom/events{/privacy}","received_events_url":"https://api.github.com/users/seanstrom/received_events","type":"User","site_admin":false},"body":"The getProxyFromURI function seems like a good candidate to remove from the\r\nrequest.js file. That file is bloated and this fits well as a module.\r\n\r\nThis is still in need of a few more changes, but I figured people can start reviewing.\r\n\r\n@simov @FredKSchott @nylen review?","created_at":"2015-01-09T03:40:34Z","updated_at":"2015-01-13T03:19:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5e443e17b0cd06bb8f4c290f1fcd96d28beb793","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/request/request/pulls/1346/commits","review_comments_url":"https://api.github.com/repos/request/request/pulls/1346/comments","review_comment_url":"https://api.github.com/repos/request/request/pulls/comments/{number}","comments_url":"https://api.github.com/repos/request/request/issues/1346/comments","statuses_url":"https://api.github.com/repos/request/request/statuses/81552c549c40e5bd22b96885325b75ed83cf93b5","head":{"label":"seanstrom:support/extract-getProxyFromURI","ref":"support/extract-getProxyFromURI","sha":"81552c549c40e5bd22b96885325b75ed83cf93b5","user":{"login":"seanstrom","id":2845768,"avatar_url":"https://avatars.githubusercontent.com/u/2845768?v=3","gravatar_id":"","url":"https://api.github.com/users/seanstrom","html_url":"https://github.com/seanstrom","followers_url":"https://api.github.com/users/seanstrom/followers","following_url":"https://api.github.com/users/seanstrom/following{/other_user}","gists_url":"https://api.github.com/users/seanstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/seanstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanstrom/subscriptions","organizations_url":"https://api.github.com/users/seanstrom/orgs","repos_url":"https://api.github.com/users/seanstrom/repos","events_url":"https://api.github.com/users/seanstrom/events{/privacy}","received_events_url":"https://api.github.com/users/seanstrom/received_events","type":"User","site_admin":false},"repo":{"id":23271047,"name":"request","full_name":"seanstrom/request","owner":{"login":"seanstrom","id":2845768,"avatar_url":"https://avatars.githubusercontent.com/u/2845768?v=3","gravatar_id":"","url":"https://api.github.com/users/seanstrom","html_url":"https://github.com/seanstrom","followers_url":"https://api.github.com/users/seanstrom/followers","following_url":"https://api.github.com/users/seanstrom/following{/other_user}","gists_url":"https://api.github.com/users/seanstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/seanstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanstrom/subscriptions","organizations_url":"https://api.github.com/users/seanstrom/orgs","repos_url":"https://api.github.com/users/seanstrom/repos","events_url":"https://api.github.com/users/seanstrom/events{/privacy}","received_events_url":"https://api.github.com/users/seanstrom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/seanstrom/request","description":"Simplified HTTP request client.","fork":true,"url":"https://api.github.com/repos/seanstrom/request","forks_url":"https://api.github.com/repos/seanstrom/request/forks","keys_url":"https://api.github.com/repos/seanstrom/request/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seanstrom/request/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seanstrom/request/teams","hooks_url":"https://api.github.com/repos/seanstrom/request/hooks","issue_events_url":"https://api.github.com/repos/seanstrom/request/issues/events{/number}","events_url":"https://api.github.com/repos/seanstrom/request/events","assignees_url":"https://api.github.com/repos/seanstrom/request/assignees{/user}","branches_url":"https://api.github.com/repos/seanstrom/request/branches{/branch}","tags_url":"https://api.github.com/repos/seanstrom/request/tags","blobs_url":"https://api.github.com/repos/seanstrom/request/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seanstrom/request/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seanstrom/request/git/refs{/sha}","trees_url":"https://api.github.com/repos/seanstrom/request/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seanstrom/request/statuses/{sha}","languages_url":"https://api.github.com/repos/seanstrom/request/languages","stargazers_url":"https://api.github.com/repos/seanstrom/request/stargazers","contributors_url":"https://api.github.com/repos/seanstrom/request/contributors","subscribers_url":"https://api.github.com/repos/seanstrom/request/subscribers","subscription_url":"https://api.github.com/repos/seanstrom/request/subscription","commits_url":"https://api.github.com/repos/seanstrom/request/commits{/sha}","git_commits_url":"https://api.github.com/repos/seanstrom/request/git/commits{/sha}","comments_url":"https://api.github.com/repos/seanstrom/request/comments{/number}","issue_comment_url":"https://api.github.com/repos/seanstrom/request/issues/comments/{number}","contents_url":"https://api.github.com/repos/seanstrom/request/contents/{+path}","compare_url":"https://api.github.com/repos/seanstrom/request/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seanstrom/request/merges","archive_url":"https://api.github.com/repos/seanstrom/request/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seanstrom/request/downloads","issues_url":"https://api.github.com/repos/seanstrom/request/issues{/number}","pulls_url":"https://api.github.com/repos/seanstrom/request/pulls{/number}","milestones_url":"https://api.github.com/repos/seanstrom/request/milestones{/number}","notifications_url":"https://api.github.com/repos/seanstrom/request/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seanstrom/request/labels{/name}","releases_url":"https://api.github.com/repos/seanstrom/request/releases{/id}","created_at":"2014-08-24T02:20:13Z","updated_at":"2015-01-08T20:52:02Z","pushed_at":"2015-01-13T02:01:30Z","git_url":"git://github.com/seanstrom/request.git","ssh_url":"git@github.com:seanstrom/request.git","clone_url":"https://github.com/seanstrom/request.git","svn_url":"https://github.com/seanstrom/request","homepage":"","size":1850,"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":"request:master","ref":"master","sha":"054d3756cb699cccb59610fe678c3bf2d6f23476","user":{"login":"request","id":730467,"avatar_url":"https://avatars.githubusercontent.com/u/730467?v=3","gravatar_id":"","url":"https://api.github.com/users/request","html_url":"https://github.com/request","followers_url":"https://api.github.com/users/request/followers","following_url":"https://api.github.com/users/request/following{/other_user}","gists_url":"https://api.github.com/users/request/gists{/gist_id}","starred_url":"https://api.github.com/users/request/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/request/subscriptions","organizations_url":"https://api.github.com/users/request/orgs","repos_url":"https://api.github.com/users/request/repos","events_url":"https://api.github.com/users/request/events{/privacy}","received_events_url":"https://api.github.com/users/request/received_events","type":"Organization","site_admin":false},"repo":{"id":1283503,"name":"request","full_name":"request/request","owner":{"login":"request","id":730467,"avatar_url":"https://avatars.githubusercontent.com/u/730467?v=3","gravatar_id":"","url":"https://api.github.com/users/request","html_url":"https://github.com/request","followers_url":"https://api.github.com/users/request/followers","following_url":"https://api.github.com/users/request/following{/other_user}","gists_url":"https://api.github.com/users/request/gists{/gist_id}","starred_url":"https://api.github.com/users/request/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/request/subscriptions","organizations_url":"https://api.github.com/users/request/orgs","repos_url":"https://api.github.com/users/request/repos","events_url":"https://api.github.com/users/request/events{/privacy}","received_events_url":"https://api.github.com/users/request/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/request/request","description":"Simplified HTTP request client.","fork":false,"url":"https://api.github.com/repos/request/request","forks_url":"https://api.github.com/repos/request/request/forks","keys_url":"https://api.github.com/repos/request/request/keys{/key_id}","collaborators_url":"https://api.github.com/repos/request/request/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/request/request/teams","hooks_url":"https://api.github.com/repos/request/request/hooks","issue_events_url":"https://api.github.com/repos/request/request/issues/events{/number}","events_url":"https://api.github.com/repos/request/request/events","assignees_url":"https://api.github.com/repos/request/request/assignees{/user}","branches_url":"https://api.github.com/repos/request/request/branches{/branch}","tags_url":"https://api.github.com/repos/request/request/tags","blobs_url":"https://api.github.com/repos/request/request/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/request/request/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/request/request/git/refs{/sha}","trees_url":"https://api.github.com/repos/request/request/git/trees{/sha}","statuses_url":"https://api.github.com/repos/request/request/statuses/{sha}","languages_url":"https://api.github.com/repos/request/request/languages","stargazers_url":"https://api.github.com/repos/request/request/stargazers","contributors_url":"https://api.github.com/repos/request/request/contributors","subscribers_url":"https://api.github.com/repos/request/request/subscribers","subscription_url":"https://api.github.com/repos/request/request/subscription","commits_url":"https://api.github.com/repos/request/request/commits{/sha}","git_commits_url":"https://api.github.com/repos/request/request/git/commits{/sha}","comments_url":"https://api.github.com/repos/request/request/comments{/number}","issue_comment_url":"https://api.github.com/repos/request/request/issues/comments/{number}","contents_url":"https://api.github.com/repos/request/request/contents/{+path}","compare_url":"https://api.github.com/repos/request/request/compare/{base}...{head}","merges_url":"https://api.github.com/repos/request/request/merges","archive_url":"https://api.github.com/repos/request/request/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/request/request/downloads","issues_url":"https://api.github.com/repos/request/request/issues{/number}","pulls_url":"https://api.github.com/repos/request/request/pulls{/number}","milestones_url":"https://api.github.com/repos/request/request/milestones{/number}","notifications_url":"https://api.github.com/repos/request/request/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/request/request/labels{/name}","releases_url":"https://api.github.com/repos/request/request/releases{/id}","created_at":"2011-01-23T01:25:14Z","updated_at":"2015-01-12T23:36:30Z","pushed_at":"2015-01-09T17:39:18Z","git_url":"git://github.com/request/request.git","ssh_url":"git@github.com:request/request.git","clone_url":"https://github.com/request/request.git","svn_url":"https://github.com/request/request","homepage":"","size":5362,"stargazers_count":6406,"watchers_count":6406,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":825,"mirror_url":null,"open_issues_count":73,"forks":825,"open_issues":73,"watchers":6406,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/request/request/pulls/1346"},"html":{"href":"https://github.com/request/request/pull/1346"},"issue":{"href":"https://api.github.com/repos/request/request/issues/1346"},"comments":{"href":"https://api.github.com/repos/request/request/issues/1346/comments"},"review_comments":{"href":"https://api.github.com/repos/request/request/pulls/1346/comments"},"review_comment":{"href":"https://api.github.com/repos/request/request/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/request/request/pulls/1346/commits"},"statuses":{"href":"https://api.github.com/repos/request/request/statuses/81552c549c40e5bd22b96885325b75ed83cf93b5"}}}}