Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

HttpHandlerDiagnosticListener: Write response event once when request is redirected #19195

Merged
merged 1 commit into from
May 1, 2017

Conversation

lmolkova
Copy link

@lmolkova lmolkova commented May 1, 2017

HttpHandlerDiagnosticListener was introduced in #18101. It allows to hook into the .NET Framework HttpClient implementation based on HttpWebRequest and get notifications with DiagnosticSource and inject correlation headers (similar to corefx instrumentation).

When HTTP request is redirected, the hook is invoked once per redirect. when request is being sent, the hook only sends one event for the first request and does not notify about each consecutive redirect.

When response is received, hook sends event for each response.

Consumers of these events uses them to log requests/responses and having the 'final' response code, actual duration and potentially details from the response is important. So every consumer for the hook needs to wait for the last response.

This fix implements it: it does not send Stop event

  • if automatic redirects are allowed
  • and response status code is one of the redirected ones
  • and number of redirects is not reached maximum allowed

Otherwise it notifies consumer about the 'final' response.

/cc @vance @davidsh

@davidsh
Copy link
Contributor

davidsh commented May 1, 2017

cc: @stephentoub

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants