From 55a2ec2613194859680f22517cd707a8dc0f932c Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Mon, 2 Dec 2019 17:42:59 +0100 Subject: [System.Net.Http]: Add workaround for mono/mono#17897. Use `(UriKind)300` (which is the same as setting `MONO_URI_DOTNETRELATIVEORABSOLUTE=true`) when parsing Uri headers. --- .../src/System/Net/Http/Headers/UriHeaderParser.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/System.Net.Http/src/System/Net/Http/Headers/UriHeaderParser.cs b/src/System.Net.Http/src/System/Net/Http/Headers/UriHeaderParser.cs index a2d483f9ff..7c0444efc4 100644 --- a/src/System.Net.Http/src/System/Net/Http/Headers/UriHeaderParser.cs +++ b/src/System.Net.Http/src/System/Net/Http/Headers/UriHeaderParser.cs @@ -13,8 +13,17 @@ namespace System.Net.Http.Headers { private UriKind _uriKind; +#if MONO + // FIXME: Workaround for https://github.com/mono/mono/issues/17897. + // This is the same as setting the MONO_URI_DOTNETRELATIVEORABSOLUTE=true + // environment variable. + // See https://github.com/mono/mono/blob/1454b010ae1165a0f2cf261b9420e32d1b52fdaf/mcs/class/referencesource/System/net/System/URI.cs#L991. + internal static readonly UriHeaderParser RelativeOrAbsoluteUriParser = + new UriHeaderParser((UriKind)300); +#else internal static readonly UriHeaderParser RelativeOrAbsoluteUriParser = new UriHeaderParser(UriKind.RelativeOrAbsolute); +#endif private UriHeaderParser(UriKind uriKind) : base(false) -- cgit v1.2.3