Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions java/src/org/openqa/selenium/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public String toString() {
}

private static final String PROXY_TYPE = "proxyType";
@Deprecated private static final String FTP_PROXY = "ftpProxy";
private static final String HTTP_PROXY = "httpProxy";
private static final String NO_PROXY = "noProxy";
private static final String SSL_PROXY = "sslProxy";
Expand All @@ -77,7 +76,6 @@ public String toString() {

private ProxyType proxyType = ProxyType.UNSPECIFIED;
private boolean autodetect = false;
@Deprecated private @Nullable String ftpProxy;
private @Nullable String httpProxy;
private @Nullable String noProxy;
private @Nullable String sslProxy;
Expand All @@ -96,7 +94,6 @@ public Proxy(Map<String, ?> raw) {
setters.put(
PROXY_TYPE,
value -> setProxyType(ProxyType.valueOf(((String) value).toUpperCase(Locale.ENGLISH))));
setters.put(FTP_PROXY, value -> setFtpProxy((String) value));
setters.put(HTTP_PROXY, value -> setHttpProxy((String) value));
setters.put(
NO_PROXY,
Expand Down Expand Up @@ -132,9 +129,6 @@ public Map<String, Object> toJson() {
if (proxyType != ProxyType.UNSPECIFIED) {
m.put(PROXY_TYPE, proxyType.toString());
}
if (ftpProxy != null) {
m.put(FTP_PROXY, ftpProxy);
}
if (httpProxy != null) {
m.put(HTTP_PROXY, httpProxy);
}
Expand Down Expand Up @@ -218,32 +212,6 @@ public Proxy setAutodetect(boolean autodetect) {
return this;
}

/**
* Gets the FTP proxy.
*
* @return the FTP proxy hostname if present, or null if not set
* @deprecated getFtpProxy is deprecated and will be removed in a future release.
*/
@Deprecated
public @Nullable String getFtpProxy() {
return ftpProxy;
}

/**
* Specify which proxy to use for FTP connections.
*
* @param ftpProxy the proxy host, expected format is <code>hostname.com:1234</code>
* @return reference to self
* @deprecated setFtpProxy is deprecated and will be removed in a future release.
*/
@Deprecated
public Proxy setFtpProxy(String ftpProxy) {
verifyProxyTypeCompatibility(ProxyType.MANUAL);
this.proxyType = ProxyType.MANUAL;
this.ftpProxy = ftpProxy;
return this;
}

/**
* Gets the HTTP proxy.
*
Expand Down Expand Up @@ -466,7 +434,6 @@ public String toString() {
break;
}

Optional.ofNullable(getFtpProxy()).ifPresent(p -> builder.append(", ftp=").append(p));
Optional.ofNullable(getHttpProxy()).ifPresent(p -> builder.append(", http=").append(p));
Optional.ofNullable(getSocksProxy()).ifPresent(p -> builder.append(", socks=").append(p));
Optional.ofNullable(getSslProxy()).ifPresent(p -> builder.append(", ssl=").append(p));
Expand All @@ -486,7 +453,6 @@ public boolean equals(@Nullable Object o) {
Proxy proxy = (Proxy) o;
return isAutodetect() == proxy.isAutodetect()
&& getProxyType() == proxy.getProxyType()
&& Objects.equals(getFtpProxy(), proxy.getFtpProxy())
&& Objects.equals(getHttpProxy(), proxy.getHttpProxy())
&& Objects.equals(getNoProxy(), proxy.getNoProxy())
&& Objects.equals(getSslProxy(), proxy.getSslProxy())
Expand All @@ -502,7 +468,6 @@ public int hashCode() {
return Objects.hash(
getProxyType(),
isAutodetect(),
getFtpProxy(),
getHttpProxy(),
getNoProxy(),
getSslProxy(),
Expand Down
20 changes: 1 addition & 19 deletions java/test/org/openqa/selenium/ProxyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ void testNotInitializedProxy() {

assertThat(proxy.getProxyType()).isEqualTo(UNSPECIFIED);

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand Down Expand Up @@ -74,8 +73,6 @@ void testCanNotChangeAlreadyInitializedProxyType() {
assertThatExceptionOfType(IllegalStateException.class)
.isThrownBy(() -> proxy.setSocksProxy(""));

assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> proxy.setFtpProxy(""));

assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> proxy.setHttpProxy(""));

assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> proxy.setNoProxy(""));
Expand Down Expand Up @@ -104,7 +101,6 @@ void testManualProxy() {

proxy
.setHttpProxy("http.proxy:1234")
.setFtpProxy("ftp.proxy")
.setSslProxy("ssl.proxy")
.setNoProxy("localhost,127.0.0.*")
.setSocksProxy("socks.proxy:65555")
Expand All @@ -113,7 +109,6 @@ void testManualProxy() {
.setSocksPassword("test2");

assertThat(proxy.getProxyType()).isEqualTo(MANUAL);
assertThat(proxy.getFtpProxy()).isEqualTo("ftp.proxy");
assertThat(proxy.getHttpProxy()).isEqualTo("http.proxy:1234");
assertThat(proxy.getSslProxy()).isEqualTo("ssl.proxy");
assertThat(proxy.getSocksProxy()).isEqualTo("socks.proxy:65555");
Expand All @@ -134,7 +129,6 @@ void testPACProxy() {
assertThat(proxy.getProxyType()).isEqualTo(PAC);
assertThat(proxy.getProxyAutoconfigUrl()).isEqualTo("http://aaa/bbb.pac");

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand All @@ -153,7 +147,6 @@ void testAutodetectProxy() {
assertThat(proxy.getProxyType().name()).isEqualTo(AUTODETECT.name());
assertThat(proxy.isAutodetect()).isTrue();

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand All @@ -169,7 +162,6 @@ void manualProxyFromMap() {
Map<String, Object> proxyData = new HashMap<>();
proxyData.put("proxyType", "manual");
proxyData.put("httpProxy", "http.proxy:1234");
proxyData.put("ftpProxy", "ftp.proxy");
proxyData.put("sslProxy", "ssl.proxy");
proxyData.put("noProxy", "localhost,127.0.0.*");
proxyData.put("socksProxy", "socks.proxy:65555");
Expand All @@ -180,7 +172,6 @@ void manualProxyFromMap() {
Proxy proxy = new Proxy(proxyData);

assertThat(proxy.getProxyType()).isEqualTo(MANUAL);
assertThat(proxy.getFtpProxy()).isEqualTo("ftp.proxy");
assertThat(proxy.getHttpProxy()).isEqualTo("http.proxy:1234");
assertThat(proxy.getSslProxy()).isEqualTo("ssl.proxy");
assertThat(proxy.getSocksProxy()).isEqualTo("socks.proxy:65555");
Expand All @@ -199,7 +190,6 @@ void longSocksVersionFromMap() {
long l = 5;
proxyData.put("proxyType", "manual");
proxyData.put("httpProxy", "http.proxy:1234");
proxyData.put("ftpProxy", "ftp.proxy");
proxyData.put("sslProxy", "ssl.proxy");
proxyData.put("noProxy", "localhost,127.0.0.*");
proxyData.put("socksProxy", "socks.proxy:65555");
Expand All @@ -217,7 +207,6 @@ void manualProxyToJson() {
Proxy proxy = new Proxy();
proxy.setProxyType(ProxyType.MANUAL);
proxy.setHttpProxy("http.proxy:1234");
proxy.setFtpProxy("ftp.proxy");
proxy.setSslProxy("ssl.proxy");
proxy.setNoProxy("localhost,127.0.0.*");
proxy.setSocksProxy("socks.proxy:65555");
Expand All @@ -228,15 +217,14 @@ void manualProxyToJson() {
Map<String, Object> json = proxy.toJson();

assertThat(json.get("proxyType")).isEqualTo("manual");
assertThat(json.get("ftpProxy")).isEqualTo("ftp.proxy");
assertThat(json.get("httpProxy")).isEqualTo("http.proxy:1234");
assertThat(json.get("sslProxy")).isEqualTo("ssl.proxy");
assertThat(json.get("socksProxy")).isEqualTo("socks.proxy:65555");
assertThat(json.get("socksVersion")).isEqualTo(5);
assertThat(json.get("socksUsername")).isEqualTo("test1");
assertThat(json.get("socksPassword")).isEqualTo("test2");
assertThat(json.get("noProxy")).asInstanceOf(LIST).containsExactly("localhost", "127.0.0.*");
assertThat(json.entrySet()).hasSize(9);
assertThat(json.entrySet()).hasSize(8);
}

@Test
Expand All @@ -250,7 +238,6 @@ void pacProxyFromMap() {
assertThat(proxy.getProxyType()).isEqualTo(PAC);
assertThat(proxy.getProxyAutoconfigUrl()).isEqualTo("http://aaa/bbb.pac");

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand Down Expand Up @@ -285,7 +272,6 @@ void autodetectProxyFromMap() {
assertThat(proxy.getProxyType()).isEqualTo(AUTODETECT);
assertThat(proxy.isAutodetect()).isTrue();

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand Down Expand Up @@ -318,7 +304,6 @@ void systemProxyFromMap() {

assertThat(proxy.getProxyType()).isEqualTo(SYSTEM);

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand Down Expand Up @@ -350,7 +335,6 @@ void directProxyFromMap() {

assertThat(proxy.getProxyType()).isEqualTo(DIRECT);

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.getHttpProxy()).isNull();
assertThat(proxy.getSslProxy()).isNull();
assertThat(proxy.getSocksProxy()).isNull();
Expand All @@ -376,14 +360,12 @@ void directProxyToJson() {
@Test
void constructingWithNullKeysWorksAsExpected() {
Map<String, String> rawProxy = new HashMap<>();
rawProxy.put("ftpProxy", null);
rawProxy.put("httpProxy", "http://www.example.com");
rawProxy.put("autodetect", null);
Capabilities caps = new ImmutableCapabilities(PROXY, rawProxy);

Proxy proxy = Proxy.extractFrom(caps);

assertThat(proxy.getFtpProxy()).isNull();
assertThat(proxy.isAutodetect()).isFalse();
assertThat(proxy.getHttpProxy()).isEqualTo("http://www.example.com");
}
Expand Down
19 changes: 3 additions & 16 deletions javascript/selenium-webdriver/lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ PacConfig.prototype.proxyAutoconfigUrl
*/
function ManualConfig() {}

/**
* The proxy host for FTP requests.
*
* @type {(string|undefined)}
*/
ManualConfig.prototype.ftpProxy

/**
* The proxy host for HTTP requests.
*
Expand Down Expand Up @@ -138,30 +131,24 @@ function direct() {
* Manually configures the browser proxy. The following options are
* supported:
*
* - `ftp`: Proxy host to use for FTP requests
* - `http`: Proxy host to use for HTTP requests
* - `https`: Proxy host to use for HTTPS requests
* - `bypass`: A list of hosts requests should directly connect to,
* bypassing any other proxies for that request. May be specified as a
* comma separated string, or a list of strings.
*
* Behavior is undefined for FTP, HTTP, and HTTPS requests if the
* Behavior is undefined for HTTP and HTTPS requests if the
* corresponding key is omitted from the configuration options.
*
* @param {{ftp: (string|undefined),
* http: (string|undefined),
* @param {{http: (string|undefined),
* https: (string|undefined),
* bypass: (Array<string>|undefined)}} options Proxy
* configuration options.
* @return {!ManualConfig} A new proxy configuration object.
*/
function manual({ ftp, http, https, bypass }) {
if (ftp !== undefined) {
console.warn('ftpProxy is deprecated and will be removed in the future')
}
function manual({ http, https, bypass }) {
return {
proxyType: Type.MANUAL,
ftpProxy: ftp,
httpProxy: http,
sslProxy: https,
noProxy: bypass,
Expand Down
2 changes: 1 addition & 1 deletion javascript/selenium-webdriver/test/proxy_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ test.suite(function (env) {
assert.strictEqual(await driver.findElement({ tagName: 'h3' }).getText(), 'This is the proxy landing page')
})

// TODO: test ftp and https proxies.
// TODO: test https proxies.
})

// PhantomJS does not support PAC file proxy configuration.
Expand Down
8 changes: 0 additions & 8 deletions rb/lib/selenium/webdriver/common/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Proxy
}.freeze

ALLOWED = {type: 'proxyType',
ftp: 'ftpProxy',
http: 'httpProxy',
no_proxy: 'noProxy',
pac: 'proxyAutoconfigUrl',
Expand Down Expand Up @@ -76,12 +75,6 @@ def ==(other)
end
alias eql? ==

def ftp=(value)
WebDriver.logger.deprecate('FTP proxy support', nil, id: :ftp_proxy)
self.type = :manual
@ftp = value
end

def http=(value)
self.type = :manual
@http = value
Expand Down Expand Up @@ -143,7 +136,6 @@ def type=(type)
def as_json(*)
json_result = {
'proxyType' => TYPES[type].downcase,
'ftpProxy' => ftp,
'httpProxy' => http,
'noProxy' => no_proxy.is_a?(String) ? no_proxy.split(',').map(&:strip).reject(&:empty?) : no_proxy,
'proxyAutoconfigUrl' => pac,
Expand Down
1 change: 0 additions & 1 deletion rb/lib/selenium/webdriver/firefox/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def proxy=(proxy)
when :manual
self['network.proxy.type'] = 1

set_manual_proxy_preference 'ftp', proxy.ftp
set_manual_proxy_preference 'http', proxy.http
set_manual_proxy_preference 'ssl', proxy.ssl
set_manual_proxy_preference 'socks', proxy.socks
Expand Down
2 changes: 0 additions & 2 deletions rb/sig/interfaces/proxy.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ interface _Proxy

def type: -> untyped

def ftp: -> untyped

def pac: -> untyped

def http: -> untyped
Expand Down
4 changes: 0 additions & 4 deletions rb/sig/lib/selenium/webdriver/common/proxy.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module Selenium
class Proxy
include _Proxy

@ftp: untyped

@http: untyped

@no_proxy: untyped
Expand Down Expand Up @@ -55,8 +53,6 @@ module Selenium

alias eql? ==

def ftp=: (untyped value) -> untyped

def http=: (untyped value) -> untyped

def no_proxy=: (untyped value) -> untyped
Expand Down
3 changes: 0 additions & 3 deletions rb/spec/unit/selenium/webdriver/firefox/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,13 @@ def read_generated_prefs(from = nil)
it 'can configure a manual proxy' do
proxy = Proxy.new(
http: 'foo:123',
ftp: 'bar:234',
ssl: 'baz:345',
no_proxy: 'localhost'
)

profile.proxy = proxy
expect(read_generated_prefs).to include('user_pref("network.proxy.http", "foo")',
'user_pref("network.proxy.http_port", 123)',
'user_pref("network.proxy.ftp", "bar")',
'user_pref("network.proxy.ftp_port", 234)',
'user_pref("network.proxy.ssl", "baz")',
'user_pref("network.proxy.ssl_port", 345)',
'user_pref("network.proxy.no_proxies_on", "localhost")',
Expand Down
3 changes: 0 additions & 3 deletions rb/spec/unit/selenium/webdriver/proxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module WebDriver
describe Proxy do
let :proxy_settings do # manual proxy settings
{
ftp: 'mythicalftpproxy:21',
http: 'mythicalproxy:80',
no_proxy: 'noproxy',
ssl: 'mythicalsslproxy',
Expand Down Expand Up @@ -57,7 +56,6 @@ module WebDriver
it 'allows valid options for a manual proxy', :aggregate_failures do
proxy = described_class.new(proxy_settings)

expect(proxy.ftp).to eq(proxy_settings[:ftp])
expect(proxy.http).to eq(proxy_settings[:http])
expect(proxy.no_proxy).to eq(proxy_settings[:no_proxy])
expect(proxy.ssl).to eq(proxy_settings[:ssl])
Expand All @@ -71,7 +69,6 @@ module WebDriver
proxy_json = described_class.new(proxy_settings).as_json

expect(proxy_json['proxyType']).to eq('manual')
expect(proxy_json['ftpProxy']).to eq(proxy_settings[:ftp])
expect(proxy_json['httpProxy']).to eq(proxy_settings[:http])
expect(proxy_json['noProxy']).to eq([proxy_settings[:no_proxy]])
expect(proxy_json['sslProxy']).to eq(proxy_settings[:ssl])
Expand Down
Loading
Loading