[2018-06] [System]: `HttpWebRequest` now throws `WebExceptionStatus.RequestCanceled...
commitfcc7e6f7636c2de21eed89f9da1a82207c6055a6
authormonojenkins <jo.shields+jenkins@xamarin.com>
Mon, 25 Jun 2018 21:17:13 +0000 (25 17:17 -0400)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 25 Jun 2018 21:17:13 +0000 (25 23:17 +0200)
tree8e8114cc8e3d8666ddeae72930d8a662c876fc22
parent18906e724204fe5192856e0ee7f8ce82c179a477
[2018-06] [System]: `HttpWebRequest` now throws `WebExceptionStatus.RequestCanceled` on abort.  (#9294)

* [System]`HttpWebRequest` now throws `WebExceptionStatus.RequestCanceled` on abort. #9031.

Cleanup the internal `HttpWebRequest.RunWithTimeout()` function and use
`GetWebException()` everywhere to throw `WebException` with
`WebExceptionStatus.RequestCanceled` on abort.

New tests for this will be added to the web-tests by extending the existing
`Xamarin.WebTests.HttpInstrumentationTests.AbortDuringHandshake` to check the
synchronous and begin/end async APIs as well, using both `GET` and `POST`.

See https://github.com/xamarin/web-tests/blob/master/Xamarin.WebTests.Tests/Xamarin.WebTests.HttpInstrumentationTests/AbortDuringHandshake.cs.

Fixes #9031.

* Fix exception checks, setting `TransferEncoding` without `SendChunked` is supposed to throw `InvalidOperationException`.

* Fix the incorrect behavior in this test.

Backport of #9212.
mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
mcs/class/System/System.Net/HttpWebRequest.cs
mcs/class/System/System.Net/WebResponseStream.cs