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

Commit 62a3d89

Browse files
author
Paulo Janotti
authored
Separate basic auth test cases for HttpClientHandler (#26713)
Separating the test cases between compliant and non-compliant names. Related to #23135
1 parent efdbbe6 commit 62a3d89

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,15 +2102,29 @@ await LoopbackServer.CreateServerAsync(async (server, url) =>
21022102
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP does not support custom proxies.")]
21032103
[OuterLoop] // TODO: Issue #11345
21042104
[Theory]
2105-
[MemberData(nameof(CredentialsForProxy))]
2106-
public async Task Proxy_BypassFalse_GetRequestGoesThroughCustomProxy(ICredentials creds, bool wrapCredsInCache)
2105+
[MemberData(nameof(CredentialsForProxyRfcCompliant))]
2106+
public async Task Proxy_BypassFalse_GetRequestGoesThroughCustomProxy_RfcCompliant(ICredentials creds, bool wrapCredsInCache)
2107+
{
2108+
await Proxy_BypassFalse_GetRequestGoesThroughCustomProxy_Implementation(creds, wrapCredsInCache);
2109+
}
2110+
2111+
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP does not support custom proxies.")]
2112+
[OuterLoop] // TODO: Issue #11345
2113+
[Theory]
2114+
[MemberData(nameof(CredentialsForProxyNonRfcCompliant))]
2115+
public async Task Proxy_BypassFalse_GetRequestGoesThroughCustomProxy_NonRfcCompliant(ICredentials creds, bool wrapCredsInCache)
21072116
{
21082117
if (UseManagedHandler)
21092118
{
21102119
// TODO #23135: ManagedHandler currently gets error "System.NotImplementedException : Basic auth: can't handle ':' in domain "dom:\ain""
21112120
return;
21122121
}
21132122

2123+
await Proxy_BypassFalse_GetRequestGoesThroughCustomProxy_Implementation(creds, wrapCredsInCache);
2124+
}
2125+
2126+
private async Task Proxy_BypassFalse_GetRequestGoesThroughCustomProxy_Implementation(ICredentials creds, bool wrapCredsInCache)
2127+
{
21142128
int port;
21152129
Task<LoopbackGetRequestHttpProxy.ProxyResult> proxyTask = LoopbackGetRequestHttpProxy.StartAsync(
21162130
out port,
@@ -2201,7 +2215,16 @@ private static IEnumerable<object[]> BypassedProxies()
22012215
yield return new object[] { new UseSpecifiedUriWebProxy(new Uri($"http://{Guid.NewGuid().ToString().Substring(0, 15)}:12345"), bypass: true) };
22022216
}
22032217

2204-
private static IEnumerable<object[]> CredentialsForProxy()
2218+
private static IEnumerable<object[]> CredentialsForProxyRfcCompliant()
2219+
{
2220+
foreach (bool wrapCredsInCache in new[] { true, false })
2221+
{
2222+
yield return new object[] { new NetworkCredential("username", "password"), wrapCredsInCache };
2223+
yield return new object[] { new NetworkCredential("username", "password", "domain"), wrapCredsInCache };
2224+
}
2225+
}
2226+
2227+
private static IEnumerable<object[]> CredentialsForProxyNonRfcCompliant()
22052228
{
22062229
yield return new object[] { null, false };
22072230
foreach (bool wrapCredsInCache in new[] { true, false })
@@ -2210,6 +2233,7 @@ private static IEnumerable<object[]> CredentialsForProxy()
22102233
yield return new object[] { new NetworkCredential("username", "password", "dom:\\ain"), wrapCredsInCache };
22112234
}
22122235
}
2236+
22132237
#endregion
22142238

22152239
#region Uri wire transmission encoding tests

0 commit comments

Comments
 (0)