Skip to content

Fix duplicate separator in HTTP logging - #7749

Merged
evgenyfedorov2 merged 2 commits into
dotnet:mainfrom
LouisDeconinck:fix-7737-unredacted-path-separator
Sep 11, 2026
Merged

evgenyfedorov2 merged 2 commits into
dotnet:mainfrom
LouisDeconinck:fix-7737-unredacted-path-separator

Conversation

@LouisDeconinck

@LouisDeconinck LouisDeconinck commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #7737

When path redaction is disabled, RequestUri.AbsolutePath already begins with /. The outgoing request formatter was adding another separator, producing messages such as GET github.com//dotnet/extensions.

Use a separator only when the logged path does not already start with /, while leaving the structured url.path value unchanged. The regression test covers the unredacted path mode.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 10, 2026 19:42
@LouisDeconinck
LouisDeconinck requested a review from a team as a code owner September 10, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ðŸŸĒ Approval recommended

The change is narrowly scoped, matches the reported behavior, and includes a targeted regression test for the failing scenario.

Pull request overview

Fixes an HTTP client logging formatting bug where the rendered message could include a duplicated / between host and path when path redaction is disabled, while keeping the structured logging tags unchanged.

Changes:

  • Adjusts the outgoing-request original-format message to conditionally add a / only when the logged path doesn’t already start with /.
  • Adds a regression test covering RequestPathParameterRedactionMode = None to ensure the rendered message doesn’t duplicate the separator.
File summaries
File Description
test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Logging/HttpClientLoggerTest.cs Adds a regression test validating unredacted path formatting does not produce a double slash.
src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs Updates the message formatter to avoid inserting an extra / when the path already begins with /.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

ðŸ’Ą Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@LouisDeconinck

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

Comment thread src/Libraries/Microsoft.Extensions.Http.Diagnostics/Logging/Internal/Log.cs Outdated
@evgenyfedorov2
evgenyfedorov2 merged commit d2364e5 into dotnet:main Sep 11, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extended HTTP client logging doubles the slash between host and path when RequestPathParameterRedactionMode = None

3 participants