diff options
Diffstat (limited to 'org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java')
-rw-r--r-- | org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java index caf08167..4ac386bb 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/client/GitHubClient.java @@ -46,6 +46,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.lang.reflect.Type; import java.net.HttpURLConnection; +import java.net.Proxy; import java.net.URL; import org.eclipse.egit.github.core.RequestError; @@ -146,6 +147,8 @@ public class GitHubClient { private String credentials; + private Proxy proxy; + private String userAgent = USER_AGENT; private String headerAccept = ACCEPT_FULL; @@ -287,6 +290,11 @@ public class GitHubClient { */ protected HttpURLConnection createConnection(String uri) throws IOException { URL url = new URL(createUri(uri)); + + if (proxy != null) { + return (HttpURLConnection) url.openConnection(proxy); + } + return (HttpURLConnection) url.openConnection(); } @@ -368,6 +376,19 @@ public class GitHubClient { } /** + * Set a proxy to use for HTPPS connections through this client. + * + * @param proxy + * to set; may be {@code null}, in which case no proxy is used + * @return this client + * @since 5.3 + */ + public GitHubClient setProxy(Proxy proxy) { + this.proxy = proxy; + return this; + } + + /** * Set OAuth2 token * * @param token |