Skip to content
This repository was archived by the owner on Aug 8, 2024. It is now read-only.

Commit 8e3b279

Browse files
authored
Modifies the RequestUri property on HttpRequestMessage to validate the same way as the constructor does. (#361)
It will now call into IsAllowedAbsoluteUri, which adds some mono specific checks.
1 parent 49b4ece commit 8e3b279

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/System.Net.Http/src/System/Net/Http/HttpRequestMessage.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,23 @@ public HttpMethod Method
8181
}
8282
}
8383

84+
8485
public Uri RequestUri
8586
{
8687
get { return _requestUri; }
8788
set
8889
{
90+
#if MONO
91+
if ((value != null) && (!IsAllowedAbsoluteUri(value)))
92+
{
93+
throw new ArgumentException(SR.net_http_client_http_baseaddress_required, nameof(value));
94+
}
95+
#else
8996
if ((value != null) && (value.IsAbsoluteUri) && (!HttpUtilities.IsHttpUri(value)))
9097
{
9198
throw new ArgumentException(SR.net_http_client_http_baseaddress_required, nameof(value));
9299
}
100+
#endif
93101
CheckDisposed();
94102

95103
// It's OK to set 'null'. HttpClient will add the 'BaseAddress'. If there is no 'BaseAddress'

0 commit comments

Comments
 (0)