Bug 44978 - HttpClientHandler.SendAsync should throw HttpRequestException for proxy auth failure
Summary: HttpClientHandler.SendAsync should throw HttpRequestException for proxy auth ...
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Net.Http (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on: 19594
Blocks:
  Show dependency tree
 
Reported: 2016-10-03 14:21 UTC by Matt Ward
Modified: 2016-10-06 10:17 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: No
Last known good build:


Attachments

Description Matt Ward 2016-10-03 14:21:28 UTC
NuGet v3 fails to request proxy credentials in Mono because the HttpClient's HttpClientHandler throws a WebException instead of throwing a HttpRequestException with the WebException set as its InnerException.

On Windows a HttpRequestException is thrown with the error message: "An error occurred while sending the request." and the WebException is set as the HttpRequestException's InnerException.

Tests for this problem are available from the following GitHub repository:

https://github.com/mrward/MonoNuGet3ProxyTests/


NuGet v3.4.4 (unpatched for Mono) catches the HttpRequestException here:

https://github.com/NuGet/NuGet.Client/blob/3.4.4-rtm/src/NuGet.Core/NuGet.Protocol.Core.v3/HttpSource/HttpHandlerResourceV3Provider.cs#L115

NuGet v3.5 has been patched for Mono with the following commit which checks that the exception thrown is a WebException:

https://github.com/NuGet/NuGet.Client/commit/375d32dd21273fd8b05e560ee556e215eea2cedc
Comment 1 Marek Safar 2016-10-05 15:59:06 UTC
Fixed in master and 4.8 branch
Comment 2 Matt Ward 2016-10-06 10:17:33 UTC
This fix looks good to me.

There seems to be another different problem where credentials for the proxy are not accepted for https package sources. Package sources that use http are OK. Mono 4.4.1 is also OK. I will look into this other problem and open a new bug with a test repro.

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.


Create a new report for Bug 44978 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Related Links: