Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 6a05a61

Browse files
committed
Fix HTTPS checks in xplat HttpClient
1 parent 417ca73 commit 6a05a61

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

src/System.Net.Http/src/Resources/Strings.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,7 @@
285285
<data name="net_cookie_attribute" xml:space="preserve">
286286
<value>The '{0}'='{1}' part of the cookie is invalid.</value>
287287
</data>
288-
</root>
288+
<data name="net_http_unix_invalid_client_cert_option" xml:space="preserve">
289+
<value>libcurl supports only manual client certificate selection</value>
290+
</data>
291+
</root>

src/System.Net.Http/src/System/Net/Http/Unix/CurlHandler.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,22 @@ internal ICredentials Credentials
107107
_serverCredentials = value;
108108
}
109109
}
110+
111+
internal ClientCertificateOption ClientCertificateOptions
112+
{
113+
get
114+
{
115+
return ClientCertificateOption.Manual;
116+
}
117+
set
118+
{
119+
if (ClientCertificateOption.Manual != value)
120+
{
121+
throw new PlatformNotSupportedException(SR.net_http_unix_invalid_client_cert_option);
122+
}
123+
}
124+
}
125+
110126
#endregion
111127

112128
protected override void Dispose(bool disposing)
@@ -127,10 +143,6 @@ protected internal override Task<HttpResponseMessage> SendAsync(
127143
{
128144
throw new ArgumentNullException("request", SR.net_http_handler_norequest);
129145
}
130-
if (request.RequestUri.Scheme == UriSchemeHttps)
131-
{
132-
throw NotImplemented.ByDesignWithMessage("HTTPS stack is not yet implemented");
133-
}
134146
if (request.Content != null)
135147
{
136148
throw NotImplemented.ByDesignWithMessage("HTTP requests with a body are not yet supported");

src/System.Net.Http/src/System/Net/Http/Unix/HttpClientHandler.Unix.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,14 @@ public CookieContainer CookieContainer
3939

4040
public ClientCertificateOption ClientCertificateOptions
4141
{
42-
get { throw NotImplemented.ByDesignWithMessage("HTTP stack not implemented"); }
43-
set { throw NotImplemented.ByDesignWithMessage("HTTP stack not implemented"); }
42+
get
43+
{
44+
return _curlHandler.ClientCertificateOptions;
45+
}
46+
set
47+
{
48+
_curlHandler.ClientCertificateOptions = value;
49+
}
4450
}
4551

4652
public DecompressionMethods AutomaticDecompression

0 commit comments

Comments
 (0)