Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
f23d7c08
R
runtime
项目概览
dotNET Platform
/
runtime
11 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f23d7c08
编写于
11月 21, 2019
作者:
S
Stephen Toub
提交者:
GitHub
11月 21, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update SslClientAuthenticationOptionsExtensions.ShallowClone to copy CipherSuitesPolicy (#211)
上级
1b441334
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
57 addition
and
3 deletion
+57
-3
src/libraries/Common/src/System/Net/Security/SslClientAuthenticationOptionsExtensions.cs
.../Net/Security/SslClientAuthenticationOptionsExtensions.cs
+57
-3
未找到文件。
src/libraries/Common/src/System/Net/Security/SslClientAuthenticationOptionsExtensions.cs
浏览文件 @
f23d7c08
...
...
@@ -2,16 +2,25 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System.Collections.Generic
;
#if DEBUG
using
System.Collections
;
using
System.Diagnostics
;
using
System.Reflection
;
#endif
namespace
System.Net.Security
{
internal
static
class
SslClientAuthenticationOptionsExtensions
{
public
static
SslClientAuthenticationOptions
ShallowClone
(
this
SslClientAuthenticationOptions
options
)
=>
new
SslClientAuthenticationOptions
()
public
static
SslClientAuthenticationOptions
ShallowClone
(
this
SslClientAuthenticationOptions
options
)
{
var
clone
=
new
SslClientAuthenticationOptions
()
{
AllowRenegotiation
=
options
.
AllowRenegotiation
,
ApplicationProtocols
=
options
.
ApplicationProtocols
,
ApplicationProtocols
=
options
.
ApplicationProtocols
!=
null
?
new
List
<
SslApplicationProtocol
>(
options
.
ApplicationProtocols
)
:
null
,
CertificateRevocationCheckMode
=
options
.
CertificateRevocationCheckMode
,
CipherSuitesPolicy
=
options
.
CipherSuitesPolicy
,
ClientCertificates
=
options
.
ClientCertificates
,
EnabledSslProtocols
=
options
.
EnabledSslProtocols
,
EncryptionPolicy
=
options
.
EncryptionPolicy
,
...
...
@@ -19,5 +28,50 @@ internal static class SslClientAuthenticationOptionsExtensions
RemoteCertificateValidationCallback
=
options
.
RemoteCertificateValidationCallback
,
TargetHost
=
options
.
TargetHost
};
#if DEBUG
// Try to detect if a property gets added that we're not copying correctly.
foreach
(
PropertyInfo
pi
in
options
.
GetType
().
GetProperties
(
BindingFlags
.
Public
|
BindingFlags
.
Instance
|
BindingFlags
.
DeclaredOnly
))
{
object
origValue
=
pi
.
GetValue
(
options
);
object
cloneValue
=
pi
.
GetValue
(
clone
);
if
(
origValue
is
IEnumerable
origEnumerable
)
{
IEnumerable
cloneEnumerable
=
cloneValue
as
IEnumerable
;
Debug
.
Assert
(
cloneEnumerable
!=
null
,
$"
{
pi
.
Name
}
. Expected enumerable cloned value."
);
IEnumerator
e1
=
origEnumerable
.
GetEnumerator
();
try
{
IEnumerator
e2
=
cloneEnumerable
.
GetEnumerator
();
try
{
while
(
e1
.
MoveNext
())
{
Debug
.
Assert
(
e2
.
MoveNext
(),
$"
{
pi
.
Name
}
. Cloned enumerator too short."
);
Debug
.
Assert
(
Equals
(
e1
.
Current
,
e2
.
Current
),
$"
{
pi
.
Name
}
. Cloned enumerator's values don't match."
);
}
Debug
.
Assert
(!
e2
.
MoveNext
(),
$"
{
pi
.
Name
}
. Cloned enumerator too long."
);
}
finally
{
(
e2
as
IDisposable
)?.
Dispose
();
}
}
finally
{
(
e1
as
IDisposable
)?.
Dispose
();
}
}
else
{
Debug
.
Assert
(
Equals
(
origValue
,
cloneValue
),
$"
{
pi
.
Name
}
. Expected:
{
origValue
}
, Actual:
{
cloneValue
}
"
);
}
}
#endif
return
clone
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录