Skip to content

Commit 3d4009c

Browse files
committed
[proxy] Mark FTP proxy support as deprecated and update related tests
1 parent 8f65de2 commit 3d4009c

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

dotnet/src/webdriver/Proxy.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class Proxy
7272
{
7373
private ProxyKind proxyKind = ProxyKind.Unspecified;
7474
private bool isAutoDetect;
75+
[Obsolete("FTP proxy support is deprecated and will be removed in a future version.")]
7576
private string? ftpProxyLocation;
7677
private string? httpProxyLocation;
7778
private string? proxyAutoConfigUrl;
@@ -118,6 +119,8 @@ public Proxy(Dictionary<string, object> settings)
118119

119120
if (settings.TryGetValue("ftpProxy", out object? ftpProxyObj) && ftpProxyObj?.ToString() is string ftpProxy)
120121
{
122+
// TODO: Remove ftpProxy in future version and remove deprecation warning
123+
// https://github.com/SeleniumHQ/selenium/issues/15905
121124
this.FtpProxy = ftpProxy;
122125
}
123126

@@ -239,8 +242,12 @@ public bool IsAutoDetect
239242
/// <summary>
240243
/// Gets or sets the value of the proxy for the FTP protocol.
241244
/// </summary>
245+
/// <remarks>
246+
/// FTP proxy support is deprecated and will be removed in a future version.
247+
/// </remarks>
242248
[JsonPropertyName("ftpProxy")]
243249
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
250+
[Obsolete("FTP proxy support is deprecated and will be removed in a future version.")]
244251
public string? FtpProxy
245252
{
246253
get => this.ftpProxyLocation;
@@ -495,6 +502,8 @@ public void AddBypassAddresses(IEnumerable<string> addressesToAdd)
495502

496503
if (!string.IsNullOrEmpty(this.ftpProxyLocation))
497504
{
505+
// TODO: Remove ftpProxy in future version and remove deprecation warning
506+
// https://github.com/SeleniumHQ/selenium/issues/15905
498507
serializedDictionary["ftpProxy"] = this.ftpProxyLocation;
499508
}
500509

dotnet/test/common/ProxyTest.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using NUnit.Framework;
2121
using System.Collections.Generic;
2222

23+
2324
namespace OpenQA.Selenium;
2425

2526
[TestFixture]
@@ -31,6 +32,8 @@ public void NotInitializedProxy()
3132
Proxy proxy = new Proxy();
3233

3334
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.Unspecified));
35+
// TODO: Remove ftpProxy in future (currently deprecated)
36+
// https://github.com/SeleniumHQ/selenium/issues/15905
3437
Assert.That(proxy.FtpProxy, Is.Null);
3538
Assert.That(proxy.HttpProxy, Is.Null);
3639
Assert.That(proxy.SslProxy, Is.Null);
@@ -54,6 +57,8 @@ public void CanNotChangeAlreadyInitializedProxyType()
5457
Assert.That(() => proxy.SocksUserName = "", Throws.InvalidOperationException);
5558
Assert.That(() => proxy.SocksProxy = "", Throws.InvalidOperationException);
5659
Assert.That(() => proxy.SocksVersion = 5, Throws.InvalidOperationException);
60+
// TODO: Remove ftpProxy in future (currently deprecated)
61+
// https://github.com/SeleniumHQ/selenium/issues/15905
5762
Assert.That(() => proxy.FtpProxy = "", Throws.InvalidOperationException);
5863
Assert.That(() => proxy.HttpProxy = "", Throws.InvalidOperationException);
5964
Assert.That(() => proxy.SslProxy = "", Throws.InvalidOperationException);
@@ -73,6 +78,8 @@ public void ManualProxy()
7378
Proxy proxy = new Proxy();
7479

7580
proxy.HttpProxy = "http.proxy:1234";
81+
// TODO: Remove ftpProxy in future (currently deprecated)
82+
// https://github.com/SeleniumHQ/selenium/issues/15905
7683
proxy.FtpProxy = "ftp.proxy";
7784
proxy.SslProxy = "ssl.proxy";
7885
proxy.AddBypassAddresses("localhost", "127.0.0.*");
@@ -82,6 +89,8 @@ public void ManualProxy()
8289
proxy.SocksPassword = "test2";
8390

8491
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.Manual));
92+
// TODO: Remove ftpProxy in future (currently deprecated)
93+
// https://github.com/SeleniumHQ/selenium/issues/15905
8594
Assert.That(proxy.FtpProxy, Is.EqualTo("ftp.proxy"));
8695
Assert.That(proxy.HttpProxy, Is.EqualTo("http.proxy:1234"));
8796
Assert.That(proxy.SslProxy, Is.EqualTo("ssl.proxy"));
@@ -104,6 +113,8 @@ public void PACProxy()
104113
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.ProxyAutoConfigure));
105114
Assert.That(proxy.ProxyAutoConfigUrl, Is.EqualTo("http://aaa/bbb.pac"));
106115

116+
// TODO: Remove ftpProxy in future (currently deprecated)
117+
// https://github.com/SeleniumHQ/selenium/issues/15905
107118
Assert.That(proxy.FtpProxy, Is.Null);
108119
Assert.That(proxy.HttpProxy, Is.Null);
109120
Assert.That(proxy.SslProxy, Is.Null);
@@ -124,6 +135,8 @@ public void AutoDetectProxy()
124135
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.AutoDetect));
125136
Assert.That(proxy.IsAutoDetect, Is.True);
126137

138+
// TODO: Remove ftpProxy in future (currently deprecated)
139+
// https://github.com/SeleniumHQ/selenium/issues/15905
127140
Assert.That(proxy.FtpProxy, Is.Null);
128141
Assert.That(proxy.HttpProxy, Is.Null);
129142
Assert.That(proxy.SslProxy, Is.Null);
@@ -142,6 +155,9 @@ public void ManualProxyFromDictionary()
142155
Dictionary<string, object> proxyData = new Dictionary<string, object>();
143156
proxyData.Add("proxyType", "manual");
144157
proxyData.Add("httpProxy", "http.proxy:1234");
158+
159+
// TODO: Remove ftpProxy in future (currently deprecated)
160+
// https://github.com/SeleniumHQ/selenium/issues/15905
145161
proxyData.Add("ftpProxy", "ftp.proxy");
146162
proxyData.Add("sslProxy", "ssl.proxy");
147163
proxyData.Add("noProxy", "localhost;127.0.0.*");
@@ -153,6 +169,9 @@ public void ManualProxyFromDictionary()
153169
Proxy proxy = new Proxy(proxyData);
154170

155171
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.Manual));
172+
173+
// TODO: Remove ftpProxy in future (currently deprecated)
174+
// https://github.com/SeleniumHQ/selenium/issues/15905
156175
Assert.That(proxy.FtpProxy, Is.EqualTo("ftp.proxy"));
157176
Assert.That(proxy.HttpProxy, Is.EqualTo("http.proxy:1234"));
158177
Assert.That(proxy.SslProxy, Is.EqualTo("ssl.proxy"));
@@ -173,6 +192,9 @@ public void LongSocksVersionFromDictionary()
173192
long longValue = 5;
174193
proxyData.Add("proxyType", "manual");
175194
proxyData.Add("httpProxy", "http.proxy:1234");
195+
196+
// TODO: Remove ftpProxy in future (currently deprecated)
197+
// https://github.com/SeleniumHQ/selenium/issues/15905
176198
proxyData.Add("ftpProxy", "ftp.proxy");
177199
proxyData.Add("sslProxy", "ssl.proxy");
178200
proxyData.Add("noProxy", "localhost,127.0.0.*");
@@ -199,6 +221,8 @@ public void PacProxyFromDictionary()
199221
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.ProxyAutoConfigure));
200222
Assert.That(proxy.ProxyAutoConfigUrl, Is.EqualTo("http://aaa/bbb.pac"));
201223

224+
// TODO: Remove ftpProxy in future (currently deprecated)
225+
// https://github.com/SeleniumHQ/selenium/issues/15905
202226
Assert.That(proxy.FtpProxy, Is.Null);
203227
Assert.That(proxy.HttpProxy, Is.Null);
204228
Assert.That(proxy.SslProxy, Is.Null);
@@ -222,6 +246,8 @@ public void AutoDetectProxyFromDictionary()
222246
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.AutoDetect));
223247
Assert.That(proxy.IsAutoDetect, Is.True);
224248

249+
// TODO: Remove ftpProxy in future (currently deprecated)
250+
// https://github.com/SeleniumHQ/selenium/issues/15905
225251
Assert.That(proxy.FtpProxy, Is.Null);
226252
Assert.That(proxy.HttpProxy, Is.Null);
227253
Assert.That(proxy.SslProxy, Is.Null);
@@ -243,6 +269,8 @@ public void SystemProxyFromDictionary()
243269

244270
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.System));
245271

272+
// TODO: Remove ftpProxy in future (currently deprecated)
273+
// https://github.com/SeleniumHQ/selenium/issues/15905
246274
Assert.That(proxy.FtpProxy, Is.Null);
247275
Assert.That(proxy.HttpProxy, Is.Null);
248276
Assert.That(proxy.SslProxy, Is.Null);
@@ -265,6 +293,8 @@ public void DirectProxyFromDictionary()
265293

266294
Assert.That(proxy.Kind, Is.EqualTo(ProxyKind.Direct));
267295

296+
// TODO: Remove ftpProxy in future (currently deprecated)
297+
// https://github.com/SeleniumHQ/selenium/issues/15905
268298
Assert.That(proxy.FtpProxy, Is.Null);
269299
Assert.That(proxy.HttpProxy, Is.Null);
270300
Assert.That(proxy.SslProxy, Is.Null);
@@ -281,14 +311,20 @@ public void DirectProxyFromDictionary()
281311
public void ConstructingWithNullKeysWorksAsExpected()
282312
{
283313
Dictionary<string, object> rawProxy = new Dictionary<string, object>();
314+
315+
// TODO: Remove ftpProxy in future (currently deprecated)
316+
// https://github.com/SeleniumHQ/selenium/issues/15905
284317
rawProxy.Add("ftpProxy", null);
285318
rawProxy.Add("httpProxy", "http://www.example.com");
286319
rawProxy.Add("autodetect", null);
287320

288321
Proxy proxy = new Proxy(rawProxy);
289322

323+
324+
// TODO: Remove ftpProxy in future (currently deprecated)
325+
// https://github.com/SeleniumHQ/selenium/issues/15905
290326
Assert.That(proxy.FtpProxy, Is.Null);
291327
Assert.That(proxy.IsAutoDetect, Is.False);
292328
Assert.That(proxy.HttpProxy, Is.EqualTo("http://www.example.com"));
293329
}
294-
}
330+
}

0 commit comments

Comments
 (0)