emgarten / Sleet

A static nuget feed generator for Azure Storage, AWS S3, and more.
MIT License
362 stars 43 forks source link

Set proxy credentials using standard 'DefaultNetworkCredentials' #68

Closed mungojam closed 5 years ago

mungojam commented 5 years ago

Fixes #63

This replaces the earlier attempt (#67) which only seemed to work occasionally. This is now using CredentialCache.DefaultNetworkCredentials which is documented as the standard way to get the credentials of the current user.

I have done more reading and experimenting and digging into the S3 SDK code and one thing to note is that the current proxy behaviour in the SDK is different between .net core and .net framework. I have verified that the solution works for .net core but could not get it to help with .net framework since the SDK doesn't look up the proxy settings for .net framework. It may be that they expect people to set it using app.config instead in which case this PR may still help.

emgarten commented 5 years ago

This looks good to me, NuGet passes this also in most cases: https://github.com/NuGet/NuGet.Client/blob/16fdc2238f3659daeedcfe55abfd9d8343fbcb2c/src/NuGet.Core/NuGet.Protocol/HttpSource/HttpSourceAuthenticationHandler.cs#L48

emgarten commented 5 years ago

Support for Proxy/Auth was difficult in NuGet client also, I think solving all of these between the Azure and S3 sdks will need to be an incremental process.