From 580defd967aa3c0bbdc985ca001bad28c6fdec80 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Tue, 27 Aug 2019 13:54:52 -0400 Subject: [PATCH] Allow file:// based Uri's to be used in HttpClient when the BaseAddress is set Fixes https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/967582 Bumps the HttpClient part in mono/corefx at: https://github.com/mono/corefx/commit/ee3acec16b37bec5016da129e1e3840097ca629b The test that would have caught this failure was disabled previously via: https://github.com/mono/mono/commit/2f411750acfd2132f9b4970ef8cf11d9a0f62df9 --- external/corefx | 2 +- mcs/class/System.Net.Http/HttpRequestMessage.Mono.cs | 4 ++++ mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/external/corefx b/external/corefx index 33308c540f2..ee3acec16b3 160000 --- a/external/corefx +++ b/external/corefx @@ -1 +1 @@ -Subproject commit 33308c540f2a06d11f555a80244728941f09f628 +Subproject commit ee3acec16b37bec5016da129e1e3840097ca629b diff --git a/mcs/class/System.Net.Http/HttpRequestMessage.Mono.cs b/mcs/class/System.Net.Http/HttpRequestMessage.Mono.cs index 87adab770f6..91f381915f1 100644 --- a/mcs/class/System.Net.Http/HttpRequestMessage.Mono.cs +++ b/mcs/class/System.Net.Http/HttpRequestMessage.Mono.cs @@ -12,6 +12,10 @@ namespace System.Net.Http return true; #endif + // Mono URI handling which does not distinguish between file and url absolute paths without scheme + if (uri.Scheme == Uri.UriSchemeFile && uri.OriginalString.StartsWith ("/", StringComparison.Ordinal)) + return true; + return HttpUtilities.IsHttpUri (uri); } } diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs index 7163231796c..402be6aa876 100644 --- a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs +++ b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs @@ -375,8 +375,7 @@ namespace MonoTests.System.Net.Http Assert.AreEqual (response, client.SendAsync (request).Result, "#1"); } - [Test] - [Category ("NotWorking")] + [Test] public void Send_BaseAddress () { var mh = new HttpMessageHandlerMock (); -- 2.11.4.GIT