Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Shulman <david.shulman@microsoft.com>2017-08-05 09:38:39 +0300
committerGitHub <noreply@github.com>2017-08-05 09:38:39 +0300
commitf7bc8b413406e94549f21be79e67641f11ae8266 (patch)
tree3d131af3d929d3ca3053c21a961623eb0ab94b82 /src
parent3d529dd5c523575c0750f85475238730fb0b49d7 (diff)
Update UAP test regarding 'TRACE' method (#22973)
* Address delayed feedback Address delayed feedback from PR #22702 and release/uwp6.0 port PR #22759 * Remove active issue on Uap TRACE test Uap platform doesn't support the 'TRACE' verb. After discussion with Wininet team, the method is explicitly not allowed. So, removing the activeissue and just skipping that part of the test. Fixes #22161
Diffstat (limited to 'src')
-rw-r--r--src/System.Net.Http/src/Resources/Strings.resx3
-rw-r--r--src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs9
-rw-r--r--src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs14
-rw-r--r--src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs16
4 files changed, 26 insertions, 16 deletions
diff --git a/src/System.Net.Http/src/Resources/Strings.resx b/src/System.Net.Http/src/Resources/Strings.resx
index 9cd1581614..ce90911392 100644
--- a/src/System.Net.Http/src/Resources/Strings.resx
+++ b/src/System.Net.Http/src/Resources/Strings.resx
@@ -123,6 +123,9 @@
<data name="net_http_httpmethod_format_error" xml:space="preserve">
<value>The format of the HTTP method is invalid.</value>
</data>
+ <data name="net_http_httpmethod_notsupported_error" xml:space="preserve">
+ <value>The HTTP method '{0}' is not supported on this platform.</value>
+ </data>
<data name="net_http_reasonphrase_format_error" xml:space="preserve">
<value>The reason phrase must not contain new-line characters.</value>
</data>
diff --git a/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs b/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs
index 094fdd2c44..64b1be0073 100644
--- a/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs
+++ b/src/System.Net.Http/src/uap/System/Net/HttpClientHandler.cs
@@ -244,7 +244,7 @@ namespace System.Net.Http
{
if (value <= 0)
{
- throw new ArgumentOutOfRangeException("value");
+ throw new ArgumentOutOfRangeException(nameof(value));
}
CheckDisposedOrStarted();
}
@@ -591,6 +591,13 @@ namespace System.Net.Http
HttpResponseMessage response;
try
{
+ if (string.Equals(request.Method.Method, HttpMethod.Trace.Method, StringComparison.OrdinalIgnoreCase))
+ {
+ // https://github.com/dotnet/corefx/issues/22161
+ throw new PlatformNotSupportedException(string.Format(CultureInfo.InvariantCulture,
+ SR.net_http_httpmethod_notsupported_error, request.Method.Method));
+ }
+
await ConfigureRequest(request).ConfigureAwait(false);
Task<HttpResponseMessage> responseTask = DiagnosticsHandler.IsEnabled() ?
diff --git a/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs b/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs
index e2bcf684bd..53e7b9b2bf 100644
--- a/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs
+++ b/src/System.Net.Http/src/uap/System/Net/HttpHandlerToFilter.cs
@@ -87,23 +87,15 @@ namespace System.Net.Http
RTHttpResponseMessage rtResponse;
try
{
- if (redirects > 0)
- {
- rtResponse = await FilterWithNoCredentials.SendRequestAsync(rtRequest).AsTask(cancel).ConfigureAwait(false);
- }
- else
- {
- rtResponse = await _filter.SendRequestAsync(rtRequest).AsTask(cancel).ConfigureAwait(false);
- }
+ rtResponse = await (redirects > 0 ? FilterWithNoCredentials : _filter).SendRequestAsync(rtRequest).AsTask(cancel).ConfigureAwait(false);
}
catch (TaskCanceledException)
{
throw;
}
- catch (Exception)
+ catch
{
- object info;
- if (rtRequest.Properties.TryGetValue(SavedExceptionDispatchInfoLookupKey, out info))
+ if (rtRequest.Properties.TryGetValue(SavedExceptionDispatchInfoLookupKey, out object info))
{
((ExceptionDispatchInfo)info).Throw();
}
diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
index bcd3dac6d0..dcf943e7c3 100644
--- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
+++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs
@@ -1632,7 +1632,6 @@ namespace System.Net.Http.Functional.Tests
#region Various HTTP Method Tests
- [ActiveIssue(22161, TargetFrameworkMonikers.Uap)]
[OuterLoop] // TODO: Issue #11345
[Theory, MemberData(nameof(HttpMethods))]
public async Task SendAsync_SendRequestUsingMethodToEchoServerWithNoContent_MethodCorrectlySent(
@@ -1644,10 +1643,19 @@ namespace System.Net.Http.Functional.Tests
var request = new HttpRequestMessage(
new HttpMethod(method),
secureServer ? Configuration.Http.SecureRemoteEchoServer : Configuration.Http.RemoteEchoServer);
- using (HttpResponseMessage response = await client.SendAsync(request))
+
+ if (PlatformDetection.IsUap && method == "TRACE")
{
- Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- TestHelper.VerifyRequestMethod(response, method);
+ HttpRequestException ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.SendAsync(request));
+ Assert.IsType<PlatformNotSupportedException>(ex.InnerException);
+ }
+ else
+ {
+ using (HttpResponseMessage response = await client.SendAsync(request))
+ {
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ TestHelper.VerifyRequestMethod(response, method);
+ }
}
}
}