diff --git a/src/libraries/System.Net.Requests/src/Resources/Strings.resx b/src/libraries/System.Net.Requests/src/Resources/Strings.resx index 4c0a7a45c146ff..8157909f348922 100644 --- a/src/libraries/System.Net.Requests/src/Resources/Strings.resx +++ b/src/libraries/System.Net.Requests/src/Resources/Strings.resx @@ -261,9 +261,6 @@ The request was aborted: The request cache-only policy does not allow a network request and the response is not found in cache. - - The ServicePointManager does not support proxies with the {0} scheme. - Reached the maximum number of BindIPEndPointDelegate retries. diff --git a/src/libraries/System.Net.Requests/src/System/Net/ServicePoint/ServicePointManager.cs b/src/libraries/System.Net.Requests/src/System/Net/ServicePoint/ServicePointManager.cs index bbf20b3e808b62..8245e309efd933 100644 --- a/src/libraries/System.Net.Requests/src/System/Net/ServicePoint/ServicePointManager.cs +++ b/src/libraries/System.Net.Requests/src/System/Net/ServicePoint/ServicePointManager.cs @@ -178,11 +178,6 @@ private static bool ProxyAddressIfNecessary(ref Uri address, IWebProxy? proxy) Uri? proxyAddress = proxy.GetProxy(address); if (proxyAddress != null) { - if (proxyAddress.Scheme != Uri.UriSchemeHttp) - { - throw new NotSupportedException(SR.Format(SR.net_proxyschemenotsupported, address.Scheme)); - } - address = proxyAddress; return true; } diff --git a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs index e88d8800f99f0f..54ad032277d875 100644 --- a/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs +++ b/src/libraries/System.Net.Requests/tests/HttpWebRequestTest.cs @@ -2406,6 +2406,15 @@ public void SendHttpRequest_BindIPEndPoint_Throws() }, IsAsync.ToString()).Dispose(); } + [Fact] + public void HttpWebRequest_HttpsAddressWithProxySetProtocolVersion_ShouldNotThrow() + { + HttpWebRequest request = (HttpWebRequest) WebRequest.Create("https://microsoft.com"); + request.Proxy = new WebProxy(); + request.ProtocolVersion = HttpVersion.Version11; + Assert.Same(HttpVersion.Version11, request.ServicePoint.ProtocolVersion); + } + private void RequestStreamCallback(IAsyncResult asynchronousResult) { RequestState state = (RequestState)asynchronousResult.AsyncState; diff --git a/src/libraries/System.Net.Requests/tests/ServicePointTests/ServicePointManagerTest.cs b/src/libraries/System.Net.Requests/tests/ServicePointTests/ServicePointManagerTest.cs index ec64068ed456fc..33f7d1ac48ba70 100644 --- a/src/libraries/System.Net.Requests/tests/ServicePointTests/ServicePointManagerTest.cs +++ b/src/libraries/System.Net.Requests/tests/ServicePointTests/ServicePointManagerTest.cs @@ -213,7 +213,6 @@ public static void InvalidArguments_Throw() AssertExtensions.Throws("address", () => ServicePointManager.FindServicePoint(null)); AssertExtensions.Throws("uriString", () => ServicePointManager.FindServicePoint((string)null, null)); AssertExtensions.Throws("address", () => ServicePointManager.FindServicePoint((Uri)null, null)); - Assert.Throws(() => ServicePointManager.FindServicePoint("http://anything", new FixedWebProxy("https://anything"))); ServicePoint sp = ServicePointManager.FindServicePoint($"http://{Guid.NewGuid():N}", null); AssertExtensions.Throws("value", () => sp.ConnectionLeaseTimeout = -2);