未验证 提交 6122bba0 编写于 作者: M Marie Píchová 提交者: GitHub

Unified request/response logging for H/2 and H/3 (#60418)

上级 98245430
......@@ -1900,7 +1900,7 @@ private enum SettingId : ushort
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, bool async, CancellationToken cancellationToken)
{
Debug.Assert(async);
if (NetEventSource.Log.IsEnabled()) Trace($"{request}");
if (NetEventSource.Log.IsEnabled()) Trace($"Sending request: {request}");
try
{
......
......@@ -140,7 +140,7 @@ public void Initialize(int streamId, int initialWindowSize)
{
StreamId = streamId;
_availableCredit = initialWindowSize;
if (NetEventSource.Log.IsEnabled()) Trace($"{_request}, {nameof(initialWindowSize)}={initialWindowSize}");
if (NetEventSource.Log.IsEnabled()) Trace($"{nameof(initialWindowSize)}={initialWindowSize}");
}
public int StreamId { get; private set; }
......@@ -1029,6 +1029,7 @@ public async Task ReadResponseHeadersAsync(CancellationToken cancellationToken)
{
responseContent.SetStream(new Http2ReadStream(this));
}
if (NetEventSource.Log.IsEnabled()) Trace($"Received response: {_response}");
// Process Set-Cookie headers.
if (_connection._pool.Settings._useCookies)
......
......@@ -203,6 +203,8 @@ public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, boo
throw new HttpRequestException(SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure);
}
if (NetEventSource.Log.IsEnabled()) Trace($"Sending request: {request}");
Task<HttpResponseMessage> responseTask = requestStream.SendAsync(cancellationToken);
// null out requestStream to avoid disposing in finally block. It is now in charge of disposing itself.
......
......@@ -235,6 +235,7 @@ public async Task<HttpResponseMessage> SendAsync(CancellationToken cancellationT
// A read stream is required to finish up the request.
responseContent.SetStream(new Http3ReadStream(this));
}
if (NetEventSource.Log.IsEnabled()) Trace($"Received response: {_response}");
// Process any Set-Cookie headers.
if (_connection.Pool.Settings._useCookies)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册