{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/comments/242714260","pull_request_review_id":186292722,"id":242714260,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjcxNDI2MA==","diff_hunk":"@@ -87,40 +88,34 @@\n    * Registers proxy credentials onto transport client, in order to deal with proxies that require\n    * basic authentication.\n    *\n-   * @param transport\n+   * @param transport Apache HTTP transport\n    */\n-  private static void addProxyCredentials(HttpTransport transport) {\n-    DefaultHttpClient httpClient =\n-        (DefaultHttpClient) ((ApacheHttpTransport) transport).getHttpClient();\n-\n-    boolean httpProxy = System.getProperty(\"http.proxyHost\") != null;\n-    boolean httpCreds =\n-        System.getProperty(\"http.proxyUser\") != null\n-            && System.getProperty(\"http.proxyPassword\") != null;\n-    if (httpProxy && httpCreds) {\n-      httpClient\n-          .getCredentialsProvider()\n-          .setCredentials(\n-              new AuthScope(\n-                  System.getProperty(\"http.proxyHost\"),\n-                  Integer.parseInt(System.getProperty(\"http.proxyPort\", \"8080\"))),\n-              new UsernamePasswordCredentials(\n-                  System.getProperty(\"http.proxyUser\"), System.getProperty(\"http.proxyPassword\")));\n-    }\n-    boolean httpsProxy = System.getProperty(\"https.proxyHost\") != null;\n-    boolean httpsCreds =\n-        System.getProperty(\"https.proxyUser\") != null\n-            && System.getProperty(\"https.proxyPassword\") != null;\n-    if (httpsProxy && httpsCreds) {\n+  private static void addProxyCredentials(ApacheHttpTransport transport) {\n+    addProxyCredentials(transport, \"https\");\n+    addProxyCredentials(transport, \"http\");\n+  }\n+\n+  private static void addProxyCredentials(ApacheHttpTransport transport, String protocol) {\n+    Preconditions.checkArgument(protocol.equals(\"http\") || protocol.equals(\"https\"));\n+\n+    boolean addCredentials =\n+        System.getProperty(protocol + \".proxyHost\") != null\n+            && System.getProperty(protocol + \".proxyUser\") != null\n+            && System.getProperty(protocol + \".proxyPassword\") != null;\n+\n+    if (addCredentials) {\n+      String defaultProxyPort = protocol.equals(\"http\") ? \"80\" : \"443\";\n+\n+      DefaultHttpClient httpClient = (DefaultHttpClient) transport.getHttpClient();\n       httpClient\n           .getCredentialsProvider()\n           .setCredentials(\n               new AuthScope(\n-                  System.getProperty(\"https.proxyHost\"),\n-                  Integer.parseInt(System.getProperty(\"https.proxyPort\", \"443\"))),\n+                  System.getProperty(protocol + \".proxyHost\"),","path":"jib-core/src/main/java/com/google/cloud/tools/jib/http/Connection.java","position":72,"original_position":72,"commit_id":"4bb0873ea8ade6efe4fa83e43c9964b770b06a49","original_commit_id":"4bb0873ea8ade6efe4fa83e43c9964b770b06a49","user":{"login":"coollog","id":4852522,"node_id":"MDQ6VXNlcjQ4NTI1MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/4852522?v=4","gravatar_id":"","url":"https://api.github.com/users/coollog","html_url":"https://github.com/coollog","followers_url":"https://api.github.com/users/coollog/followers","following_url":"https://api.github.com/users/coollog/following{/other_user}","gists_url":"https://api.github.com/users/coollog/gists{/gist_id}","starred_url":"https://api.github.com/users/coollog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coollog/subscriptions","organizations_url":"https://api.github.com/users/coollog/orgs","repos_url":"https://api.github.com/users/coollog/repos","events_url":"https://api.github.com/users/coollog/events{/privacy}","received_events_url":"https://api.github.com/users/coollog/received_events","type":"User","site_admin":false},"body":"nit: Perhaps change to single calls to `getProperty` and hold in variables?","created_at":"2018-12-18T21:35:44Z","updated_at":"2018-12-18T21:40:08Z","html_url":"https://github.com/GoogleContainerTools/jib/pull/1366#discussion_r242714260","pull_request_url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/comments/242714260"},"html":{"href":"https://github.com/GoogleContainerTools/jib/pull/1366#discussion_r242714260"},"pull_request":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366","id":239637076,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5NjM3MDc2","html_url":"https://github.com/GoogleContainerTools/jib/pull/1366","diff_url":"https://github.com/GoogleContainerTools/jib/pull/1366.diff","patch_url":"https://github.com/GoogleContainerTools/jib/pull/1366.patch","issue_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1366","number":1366,"state":"open","locked":false,"title":"Fix issues around adding proxy credentials to Apache HttpClient","user":{"login":"chanseokoh","id":10523105,"node_id":"MDQ6VXNlcjEwNTIzMTA1","avatar_url":"https://avatars2.githubusercontent.com/u/10523105?v=4","gravatar_id":"","url":"https://api.github.com/users/chanseokoh","html_url":"https://github.com/chanseokoh","followers_url":"https://api.github.com/users/chanseokoh/followers","following_url":"https://api.github.com/users/chanseokoh/following{/other_user}","gists_url":"https://api.github.com/users/chanseokoh/gists{/gist_id}","starred_url":"https://api.github.com/users/chanseokoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chanseokoh/subscriptions","organizations_url":"https://api.github.com/users/chanseokoh/orgs","repos_url":"https://api.github.com/users/chanseokoh/repos","events_url":"https://api.github.com/users/chanseokoh/events{/privacy}","received_events_url":"https://api.github.com/users/chanseokoh/received_events","type":"User","site_admin":false},"body":"Fixes several issues after merging #1337\r\n\r\n- `System.getProperty(\"http.proxyPort\", \"8080\")`\r\n\r\n   [According to the Oracle doc, the default proxy port is 80, not 8080](https://docs.oracle.com/javase/7/docs/api/java/net/doc-files/net-properties.html).\r\n\r\n- No tests (not ready yet)\r\n\r\n- Mutable `PROXY_PROPERTIES`\r\n\r\n- Minor doc issues","created_at":"2018-12-18T21:26:39Z","updated_at":"2018-12-18T21:40:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df857931f86d386a55089cfcffef05cdd1341ab0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":820236577,"node_id":"MDU6TGFiZWw4MjAyMzY1Nzc=","url":"https://api.github.com/repos/GoogleContainerTools/jib/labels/PR:%20Not%20Ready","name":"PR: Not Ready","color":"b60205","default":false},{"id":1016518109,"node_id":"MDU6TGFiZWwxMDE2NTE4MTA5","url":"https://api.github.com/repos/GoogleContainerTools/jib/labels/cla:%20yes","name":"cla: yes","color":"ededed","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366/commits","review_comments_url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366/comments","review_comment_url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1366/comments","statuses_url":"https://api.github.com/repos/GoogleContainerTools/jib/statuses/4bb0873ea8ade6efe4fa83e43c9964b770b06a49","head":{"label":"GoogleContainerTools:i1365-finish-proxy-auth","ref":"i1365-finish-proxy-auth","sha":"4bb0873ea8ade6efe4fa83e43c9964b770b06a49","user":{"login":"GoogleContainerTools","id":38444003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDQ0MDAz","avatar_url":"https://avatars1.githubusercontent.com/u/38444003?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleContainerTools","html_url":"https://github.com/GoogleContainerTools","followers_url":"https://api.github.com/users/GoogleContainerTools/followers","following_url":"https://api.github.com/users/GoogleContainerTools/following{/other_user}","gists_url":"https://api.github.com/users/GoogleContainerTools/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleContainerTools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleContainerTools/subscriptions","organizations_url":"https://api.github.com/users/GoogleContainerTools/orgs","repos_url":"https://api.github.com/users/GoogleContainerTools/repos","events_url":"https://api.github.com/users/GoogleContainerTools/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleContainerTools/received_events","type":"Organization","site_admin":false},"repo":{"id":118497841,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg0OTc4NDE=","name":"jib","full_name":"GoogleContainerTools/jib","private":false,"owner":{"login":"GoogleContainerTools","id":38444003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDQ0MDAz","avatar_url":"https://avatars1.githubusercontent.com/u/38444003?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleContainerTools","html_url":"https://github.com/GoogleContainerTools","followers_url":"https://api.github.com/users/GoogleContainerTools/followers","following_url":"https://api.github.com/users/GoogleContainerTools/following{/other_user}","gists_url":"https://api.github.com/users/GoogleContainerTools/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleContainerTools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleContainerTools/subscriptions","organizations_url":"https://api.github.com/users/GoogleContainerTools/orgs","repos_url":"https://api.github.com/users/GoogleContainerTools/repos","events_url":"https://api.github.com/users/GoogleContainerTools/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleContainerTools/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/GoogleContainerTools/jib","description":":sailboat: Build container images for your Java applications.","fork":false,"url":"https://api.github.com/repos/GoogleContainerTools/jib","forks_url":"https://api.github.com/repos/GoogleContainerTools/jib/forks","keys_url":"https://api.github.com/repos/GoogleContainerTools/jib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleContainerTools/jib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleContainerTools/jib/teams","hooks_url":"https://api.github.com/repos/GoogleContainerTools/jib/hooks","issue_events_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleContainerTools/jib/events","assignees_url":"https://api.github.com/repos/GoogleContainerTools/jib/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleContainerTools/jib/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleContainerTools/jib/tags","blobs_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleContainerTools/jib/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleContainerTools/jib/languages","stargazers_url":"https://api.github.com/repos/GoogleContainerTools/jib/stargazers","contributors_url":"https://api.github.com/repos/GoogleContainerTools/jib/contributors","subscribers_url":"https://api.github.com/repos/GoogleContainerTools/jib/subscribers","subscription_url":"https://api.github.com/repos/GoogleContainerTools/jib/subscription","commits_url":"https://api.github.com/repos/GoogleContainerTools/jib/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleContainerTools/jib/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleContainerTools/jib/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleContainerTools/jib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleContainerTools/jib/merges","archive_url":"https://api.github.com/repos/GoogleContainerTools/jib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleContainerTools/jib/downloads","issues_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleContainerTools/jib/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleContainerTools/jib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleContainerTools/jib/labels{/name}","releases_url":"https://api.github.com/repos/GoogleContainerTools/jib/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleContainerTools/jib/deployments","created_at":"2018-01-22T18:30:43Z","updated_at":"2018-12-18T21:06:15Z","pushed_at":"2018-12-18T21:26:39Z","git_url":"git://github.com/GoogleContainerTools/jib.git","ssh_url":"git@github.com:GoogleContainerTools/jib.git","clone_url":"https://github.com/GoogleContainerTools/jib.git","svn_url":"https://github.com/GoogleContainerTools/jib","homepage":"","size":6887,"stargazers_count":5116,"watchers_count":5116,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":393,"mirror_url":null,"archived":false,"open_issues_count":98,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":393,"open_issues":98,"watchers":5116,"default_branch":"master"}},"base":{"label":"GoogleContainerTools:master","ref":"master","sha":"c52c399b96801bfa140937ae284af4d67d940bd2","user":{"login":"GoogleContainerTools","id":38444003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDQ0MDAz","avatar_url":"https://avatars1.githubusercontent.com/u/38444003?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleContainerTools","html_url":"https://github.com/GoogleContainerTools","followers_url":"https://api.github.com/users/GoogleContainerTools/followers","following_url":"https://api.github.com/users/GoogleContainerTools/following{/other_user}","gists_url":"https://api.github.com/users/GoogleContainerTools/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleContainerTools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleContainerTools/subscriptions","organizations_url":"https://api.github.com/users/GoogleContainerTools/orgs","repos_url":"https://api.github.com/users/GoogleContainerTools/repos","events_url":"https://api.github.com/users/GoogleContainerTools/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleContainerTools/received_events","type":"Organization","site_admin":false},"repo":{"id":118497841,"node_id":"MDEwOlJlcG9zaXRvcnkxMTg0OTc4NDE=","name":"jib","full_name":"GoogleContainerTools/jib","private":false,"owner":{"login":"GoogleContainerTools","id":38444003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM4NDQ0MDAz","avatar_url":"https://avatars1.githubusercontent.com/u/38444003?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleContainerTools","html_url":"https://github.com/GoogleContainerTools","followers_url":"https://api.github.com/users/GoogleContainerTools/followers","following_url":"https://api.github.com/users/GoogleContainerTools/following{/other_user}","gists_url":"https://api.github.com/users/GoogleContainerTools/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleContainerTools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleContainerTools/subscriptions","organizations_url":"https://api.github.com/users/GoogleContainerTools/orgs","repos_url":"https://api.github.com/users/GoogleContainerTools/repos","events_url":"https://api.github.com/users/GoogleContainerTools/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleContainerTools/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/GoogleContainerTools/jib","description":":sailboat: Build container images for your Java applications.","fork":false,"url":"https://api.github.com/repos/GoogleContainerTools/jib","forks_url":"https://api.github.com/repos/GoogleContainerTools/jib/forks","keys_url":"https://api.github.com/repos/GoogleContainerTools/jib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleContainerTools/jib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleContainerTools/jib/teams","hooks_url":"https://api.github.com/repos/GoogleContainerTools/jib/hooks","issue_events_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleContainerTools/jib/events","assignees_url":"https://api.github.com/repos/GoogleContainerTools/jib/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleContainerTools/jib/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleContainerTools/jib/tags","blobs_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleContainerTools/jib/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleContainerTools/jib/languages","stargazers_url":"https://api.github.com/repos/GoogleContainerTools/jib/stargazers","contributors_url":"https://api.github.com/repos/GoogleContainerTools/jib/contributors","subscribers_url":"https://api.github.com/repos/GoogleContainerTools/jib/subscribers","subscription_url":"https://api.github.com/repos/GoogleContainerTools/jib/subscription","commits_url":"https://api.github.com/repos/GoogleContainerTools/jib/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleContainerTools/jib/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleContainerTools/jib/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleContainerTools/jib/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleContainerTools/jib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleContainerTools/jib/merges","archive_url":"https://api.github.com/repos/GoogleContainerTools/jib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleContainerTools/jib/downloads","issues_url":"https://api.github.com/repos/GoogleContainerTools/jib/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleContainerTools/jib/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleContainerTools/jib/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleContainerTools/jib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleContainerTools/jib/labels{/name}","releases_url":"https://api.github.com/repos/GoogleContainerTools/jib/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleContainerTools/jib/deployments","created_at":"2018-01-22T18:30:43Z","updated_at":"2018-12-18T21:06:15Z","pushed_at":"2018-12-18T21:26:39Z","git_url":"git://github.com/GoogleContainerTools/jib.git","ssh_url":"git@github.com:GoogleContainerTools/jib.git","clone_url":"https://github.com/GoogleContainerTools/jib.git","svn_url":"https://github.com/GoogleContainerTools/jib","homepage":"","size":6887,"stargazers_count":5116,"watchers_count":5116,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":393,"mirror_url":null,"archived":false,"open_issues_count":98,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":393,"open_issues":98,"watchers":5116,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366"},"html":{"href":"https://github.com/GoogleContainerTools/jib/pull/1366"},"issue":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1366"},"comments":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/issues/1366/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/pulls/1366/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleContainerTools/jib/statuses/4bb0873ea8ade6efe4fa83e43c9964b770b06a49"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"coollog"}}