-
Notifications
You must be signed in to change notification settings - Fork 2.2k
ProxyOptions change #11656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProxyOptions change #11656
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,8 @@ | |
|
|
||
| package com.azure.cosmos; | ||
|
|
||
| import java.net.InetSocketAddress; | ||
| import com.azure.core.http.ProxyOptions; | ||
|
|
||
| import java.time.Duration; | ||
|
|
||
| /** | ||
|
|
@@ -18,7 +19,7 @@ public final class GatewayConnectionConfig { | |
| private Duration requestTimeout; | ||
| private int maxConnectionPoolSize; | ||
| private Duration idleConnectionTimeout; | ||
| private InetSocketAddress inetSocketProxyAddress; | ||
| private ProxyOptions proxy; | ||
|
|
||
| /** | ||
| * Constructor. | ||
|
|
@@ -103,12 +104,12 @@ public GatewayConnectionConfig setIdleConnectionTimeout(Duration idleConnectionT | |
| } | ||
|
|
||
| /** | ||
| * Gets the InetSocketAddress of proxy server. | ||
| * Gets the proxy options which contain the InetSocketAddress of proxy server. | ||
| * | ||
| * @return the value of proxyHost. | ||
| * @return the proxy options. | ||
| */ | ||
| public InetSocketAddress getProxy() { | ||
| return this.inetSocketProxyAddress; | ||
| public ProxyOptions getProxy() { | ||
| return this.proxy; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -119,18 +120,26 @@ public InetSocketAddress getProxy() { | |
| * @return the {@link GatewayConnectionConfig}. | ||
| */ | ||
|
|
||
| public GatewayConnectionConfig setProxy(InetSocketAddress proxy) { | ||
| this.inetSocketProxyAddress = proxy; | ||
| public GatewayConnectionConfig setProxy(ProxyOptions proxy) { | ||
| if (proxy.getType() != ProxyOptions.Type.HTTP) { | ||
| throw new IllegalArgumentException("Only http proxy type is supported."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as we don't support password with proxy, shouldn't we throw if password is set?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure. may be we should, may be we should not, it will just get ignored. But we definitely should add more documentation to setProxy() API that we only support HTTP proxy as of now - without any username and password. I see, @xinlian12 - please create another PR for this - with updated docs - "that we only support HTTP proxy type with just the routing address. Username and password are not supported"
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks~ have created another PR for the docs update: |
||
| } | ||
|
|
||
| this.proxy = proxy; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| String proxyType = proxy != null ? proxy.getType().toString() : null; | ||
| String proxyAddress = proxy != null ? proxy.getAddress().toString() : null; | ||
|
|
||
| return "GatewayConnectionConfig{" + | ||
| "requestTimeout=" + requestTimeout + | ||
| ", maxConnectionPoolSize=" + maxConnectionPoolSize + | ||
| ", idleConnectionTimeout=" + idleConnectionTimeout + | ||
| ", inetSocketProxyAddress=" + inetSocketProxyAddress + | ||
| ", proxyType=" + proxyType + | ||
| ", inetSocketProxyAddress=" + proxyAddress + | ||
| '}'; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.