Skip to content

dotnet-dump and dotnet-symbol returns 407 behind a proxy #5478

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ladeak
Copy link

@ladeak ladeak commented May 8, 2025

dotnet-dump and dotnet-symbol returns HTTP 407 status code behind a proxy when downloading symbols. Setting the default network credentials before HttpClient is created. Optionally HttpSymbolStore could create a custom HttpClientHandler too (different solution because of netstandard2.0), but based on the remarks this is only desired for client applications. I am not sure how this Microsoft.SymbolStore project is used otherwise. Hence, dotnet-dump and dotnet-symbol sets the default proxy credentials before creating a HttpSymbolStore.

…ding symbols. Setting the default network credentials before HttpClient is set. Optionally HttpSymbolStore could create a custom HttpClientHandler, but based on the remarks https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.usedefaultcredentials?view=net-9.0 this is only desired for client applications, while not sure how this project is used otherwise.
@ladeak ladeak requested a review from a team as a code owner May 8, 2025 19:00
@tommcdon tommcdon requested review from mikem8361 and hoyosjs May 8, 2025 19:03
@ladeak ladeak force-pushed the httpclient-defaultnetworkcredentials branch from 6d8b50c to fe89400 Compare May 9, 2025 19:14
@ladeak ladeak force-pushed the httpclient-defaultnetworkcredentials branch from fe89400 to c9cb4c9 Compare May 9, 2025 19:15
@@ -67,7 +67,15 @@ public HttpSymbolStore(ITracer tracer, SymbolStore backingStore, Uri symbolServe
_authenticationFunc = authenticationFunc;

// Create client
_client = new HttpClient
#if NETSTANDARD2_0
Copy link
Author

@ladeak ladeak May 9, 2025

Choose a reason for hiding this comment

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

I believe this is enough, but I can only fully test it on Monday.

Ref:
https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.defaultproxycredentials?view=netstandard-2.0#system-net-http-httpclienthandler-defaultproxycredentials

and

https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.usedefaultcredentials?view=netstandard-2.0

Proxy is left default, UseProxy is set to true, DefaultProxyCredentials set.

EDIT I find this change more risky. HttpClientHandler has different behavior on .net462, .net8, .net9.

@ladeak ladeak requested a review from mikem8361 May 9, 2025 19:25
@ladeak
Copy link
Author

ladeak commented May 13, 2025

@mikem8361 - any suggestions?

@mikem8361
Copy link

@hoyosjs can you look at this?

@mikem8361 mikem8361 removed their request for review May 13, 2025 20:26
@ladeak
Copy link
Author

ladeak commented May 19, 2025

@mikem8361 or @hoyosjs could you please have a look?

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

Successfully merging this pull request may close these issues.

2 participants