Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP PlatformHandlerTest_Cookies_Http2.GetAsync_ReceiveSetCookieHeader test failure #34065

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Net.Test.Common;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DotNet.XUnitExtensions;
using Xunit;
Expand All @@ -17,6 +19,31 @@ namespace System.Net.Http.Functional.Tests
using HttpClientHandler = System.Net.Http.WinHttpClientHandler;
#endif

internal sealed class HttpEventListener : EventListener
{
private readonly ITestOutputHelper _output;

public HttpEventListener(ITestOutputHelper output) => _output = output;

protected override void OnEventSourceCreated(EventSource eventSource)
{
if (eventSource.Name == "Microsoft-System-Net-Http" || eventSource.Name == "Microsoft-System-Net-Http-WinHttpHandler")
EnableEvents(eventSource, EventLevel.LogAlways);
}

protected override void OnEventWritten(EventWrittenEventArgs eventData)
{
var sb = new StringBuilder().Append($"[{eventData.EventName}] ");
for (int i = 0; i < eventData.Payload?.Count; i++)
{
if (i > 0)
sb.Append(", ");
sb.Append(eventData.PayloadNames?[i]).Append(": ").Append(eventData.Payload[i]);
}
_output.WriteLine(sb.ToString());
}
}

public abstract class HttpClientHandlerTest_Cookies : HttpClientHandlerTestBase
{
private const string s_cookieName = "ABC";
Expand All @@ -27,7 +54,18 @@ public abstract class HttpClientHandlerTest_Cookies : HttpClientHandlerTestBase

private const string s_simpleContent = "Hello world!";

public HttpClientHandlerTest_Cookies(ITestOutputHelper output) : base(output) { }
private EventListener _listener;

public HttpClientHandlerTest_Cookies(ITestOutputHelper output) : base(output)
{
_listener = new HttpEventListener(output);
}

protected override void Dispose(bool disposing)
{
_listener.Dispose();
base.Dispose(disposing);
}

//
// Send cookie tests
Expand Down Expand Up @@ -331,12 +369,7 @@ await LoopbackServerFactory.CreateClientAndServerAsync(async url =>
[MemberData(nameof(CookieNamesValuesAndUseCookies))]
public async Task GetAsync_ReceiveSetCookieHeader_CookieAdded(string cookieName, string cookieValue, bool useCookies)
{
if (UseVersion.Major == 2)
{
// [ActiveIssue("https://github.com/dotnet/runtime/issues/33930")]
return;
}

_output.WriteLine($"GetAsync_ReceiveSetCookieHeader_CookieAdded {cookieName}={cookieValue} {useCookies}");
await LoopbackServerFactory.CreateServerAsync(async (server, url) =>
{
HttpClientHandler handler = CreateHttpClientHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,12 @@ private void SetEnableHttp2PlusClientCertificate(Uri requestUri, Version request
}
else
{
if (NetEventSource.IsEnabled) NetEventSource.Info(this, "HTTP/2 with TLS client cert not supported");
if (NetEventSource.IsEnabled)
{
var error = WinHttpException.CreateExceptionUsingLastError(
nameof(Interop.WinHttp.WinHttpQueryDataAvailable));
NetEventSource.Info(this, $"HTTP/2 with TLS client cert not supported: {error}");
}
}
}

Expand Down