252 Commits
Author SHA1 Message Date
Kenneth Pouncey 202cb6a648 Add more descriptive message to the PlatformNotSupportedException (#17864) 2019-11-22 08:40:30 +01:00
monojenkins a4790c892d [csproj] Update project files 2019-11-01 14:25:26 +00:00
Martin Baulig 578e0df42f [System.Net.Http]: Bring HttpClient from CoreFX on monotouch and xammac. 2019-10-30 15:37:25 -04:00
Thays Grazia 0d357c1347 [tests] Replace __WATCHOS__ with MONOTOUCH_WATCH (#17459)
Fixes the conditional from mono/mono#17423, we don't define __WATCHOS__ in the Mono BCL builds. We use MONOTOUCH_WATCH instead.
2019-10-21 16:20:12 +02:00
Thays Grazia 105ead8707 Changing behavior of some tests in WatchOs
Needs this ifdefs because of this https://github.com/mono/mono/pull/17260. (#17423)
2019-10-18 21:23:44 -04:00
Marek Safar cae52aa4a6 [System.Net.Http] Clean up HttpMessageHandler setup (#17252)
* [System.Net.Http] Clean up HttpMessageHandler setup

to avoid reflection and not to be recursive

Superseded #15051 and #15922

* [csproj] Update project files
2019-10-14 17:19:22 +02:00
monojenkins 3ef0544e7a [csproj] Update project files 2019-10-10 19:43:11 +02:00
Marek Safar 502115435d [System.Net.Http] Make HttpClientHandler on WatchOS always fallback
to platform handler. This simplifies HttpClientHandler in shared libraries
and the "default" socket handler would always throw PNSE anyway
2019-10-10 19:43:11 +02:00
Martin Baulig 1256d6c8cf Use NetworkStream from CoreFX. (#16889)
* Use `NetworkStream` from CoreFX.

This brings the `NetworkStream` class and related tests from CoreFX.

* `SocketAsyncEventArgs`: partially replace the following properties
  with the CoreFX version: `Buffer`, `BufferList`, `Offset`, `SetBuffer ()`
  as well as the internal `CopyBufferFrom ()`.

* `SocketAsyncResult`: change `Buffer` from `byte[]` to `Memory<byte>`.

* Add internal `Socket` overloads:
   - `Receive (Memory<byte> buffer, int, int, SocketFlags, out SocketError)`
   - `ReceiveFrom (Memory<byte>, int, int, SocketFlags, ref EndPoint, out SocketError)`
   - `SendTo (Memory<byte>, int, int, SocketFlags, EndPoint)`

* Implement async task overloads from CoreFX (`Socket.Tasks.cs`) to `Socket`:
   - `int Read(Span<byte>)`
   - `Task<int> ReadAsync(byte[], int, int, CancellationToken)`
   - `ValueTask<int> ReadAsync(Memory<byte>, CancellationToken)`
   - `int ReadByte()`
   - `void Write(ReadOnlySpan<byte>)`
   - `Task WriteAsync(byte[], int, int, CancellationToken)`
   - `ValueTask WriteAsync(ReadOnlyMemory<byte>, CancellationToken)`
   - `void WriteByte(byte)`

* remove internal unused `PooledStream` and `ConnectionPool` APIs.

* bring new tests from CoreFX:
  - `System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.cs`
  - `System.Net.Sockets/tests/FunctionalTests/NetworkStreamTest.netcoreapp.cs`

* corlib: add `System.IO.FileSystem` and `System.Net.Sockets` resources and update SR.

* Update Socket.cs

* [csproj] Update project files

* Bump API snapshot submodule
2019-09-19 14:46:29 +02:00
Steve Pfister 580defd967 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
2019-08-27 13:54:52 -04:00
Egor Bogatov 4febac951e [bcl] Sync recent NS2.1 changes (#15696)
1) Copied changes from corefx for System.Data (also https://github.com/mono/corefx/pull/310)
2) New Tracing api is left empty (because the current API is empty too)
3) New AES types throw PNSE

Bump netstandard.dll AssemblyVersion to 2.1 (fixes https://github.com/mono/mono/issues/13412)
2019-07-17 13:08:29 +02:00
Martin Baulig 3508cd8026 [System.Net.Http]: Delete broken Send_Transfer_Encoding_Custom() test. (#15470)
This test was checking a broken Mono-specific behavior, which has been
removed after we switched to the new corefx-based handler. It also does
not make much sense to use a `Transfer-Encoding` header with a GET request.
2019-07-02 01:27:42 +02:00
Ryan Lucia 8e4d1eb06f Disable flaky test HttpClientTest.CancelRequestViaProxy 2019-06-26 21:01:58 -05:00
Johan Lorensson dfb46dad7d Add Windows x64 Full AOT Interpreter support on CI. (#15127)
Add support to run full interpreter test suite on CI for Windows x64 Full AOT.
Since Windows x64 Full AOT uses a different full AOT profile WinAOT a separate
testing profile was setup for the interpreter testing. NOTE, this profile is
pure for testing, inline with the other testing profiles. It is also reusing
most of its sources from other sources files (mainly WinAOT) to reduce maintenance
of the profile.

Commit also includes some smaller adjustments needed in order to get full
pass rate for Windows x64 Full AOT + Interpreter on CI.
2019-06-20 09:23:39 +02:00
Martin Baulig a44db72a1c [System.Net.Http]: Add hack to the legacy HttpClient to pass down Timeout property. #12577. (#14970)
* [System.Net.Http]: Add hack to the legacy HttpClient to pass down Timeout property. #12577.

* `HttpClientHandler`, `IMonoHttpClientHandler`: add new internal `MonoSetTimeout (TimeSpan)` function.

* `HttpClient.SendAsyncWorker()`: if `handler` is `HttpClientHandler`, call the new internal
  `MonoSetTimeout()` function to pass down the timeout.

* `MonoWebRequestHandler.SendAsync()`: this is only used here to pass the timeout to the `HttpWebRequest`.

* Address feedback.

* Update HttpMessageInvoker.cs

* Make it build.

* Really make it build (forgot monotouch_watch).
2019-06-12 09:42:20 +02:00
Alexander Köplinger 9606a8f180 [bcl] Remove usages of mono-project.com/go-mono.com/google.com in tests (#14586)
Use example.com and example.org instead.

Fixes https://github.com/mono/mono/issues/14585

Note that not all of the things I replaced make an actual network request but I thought it'd be nice to be consistent.
2019-05-23 14:12:14 +02:00
monojenkins 0da2ba771b [csproj] Update project files 2019-04-30 12:14:57 +02:00
Martin Baulig 06487590ff Define DISABLE_SECURITY and DISABLE_REMOTING on wasm and testing_aot. 2019-04-29 15:47:04 +02:00
monojenkins 3d7a63ba17 [csproj] Update project files 2019-04-25 09:17:13 +02:00
Alexander Köplinger 183b22b4db [System.Net.Http] Make some tests specific to HttpClientHandler
Otherwise they throw PNSE on e.g. WatchOS.

(cherry picked from commit 0b6dbfa349)
2019-04-10 15:03:50 +02:00
Alexander Köplinger 5cce664b6f Update System.Net.Http for Watch
(cherry picked from commit 4e3ef48ff0)
2019-03-30 00:13:07 +01:00
Alexander Köplinger a2462e19e9 [System.Net.Http] Add IVT to Xamarin.* assemblies and update Mac
NSUrlSessionHandler is in Foundation namespace on XM

(cherry picked from commit 5460d8af74)
2019-03-29 23:48:52 +01:00
Alexander Köplinger 15a0b97b10 [System.Net.Http] Move Mac/iOS specific HttpMessageHandler's to Xamarin.*.dll (#13746)
* Revert "[System.Net.Http] Move NSUrlSessionHandler from xamarin-macios to mono (#13229)"

This reverts commit 5bf74a9954.

* [System.Net.Http] Move Mac/iOS specific HttpMessageHandler's to Xamarin.*.dll

We decided to move these types into Xamarin products since they can't be
used without the underlying infrastructure anyway.

* Bump API snapshot submodule

* [csproj] Update project files
2019-03-29 19:27:07 +01:00
Alexander Köplinger 5521ad349f [System.Net.Http] Port https://github.com/xamarin/xamarin-macios/pull/5769 to mono 2019-03-18 14:39:54 +01:00
Alexander Köplinger 8cd69e14e3 Update System.Net.Http.csproj
Change missed in https://github.com/mono/mono/commit/97adf2e53e20c127bc38cb4f64a43f55c77e5c7e
2019-03-07 23:41:22 +01:00
Martin Baulig 97adf2e53e HttpClient for Web Assembly. 2019-03-07 21:49:27 +01:00
monojenkins ebb8b6fff2 [csproj] Update project files 2019-03-07 18:47:03 +01:00
Martin Baulig 2d6f02a83c HttpClient for Android. 2019-03-07 18:47:03 +01:00
Martin Baulig 6034bc00c4 Introducing HttpClient.CreateDefaultHandler(). (#13305)
* The default `HttpClient` constructor now calls a static method `CreateDefaultHandler()`;
   we provide a platform-specific implementation of it.

* Replaced `HeaderUtils` with `PlatformHelper` and removed the `LEGACY_HTTPCLIENT` conditional.

* Added a new `socketshandler.sources` file to keep the sources in one place.

* Use a reflection check in the tests instead of the `LEGACY_HTTPCLIENT` conditional.

* This allows us to also get rid of the `SOCKETSHTTPHANDLER` define.
2019-03-06 20:56:42 +01:00
Egor Bogatov e42bf95d14 NS2.1 Sync new changes, mobile profiles (#13198)
* Add RuntimeHelpers.GetSubArray. Add missing types to NS's TypeForwarders.cs

* more NS2.1 changes

* ios changes

* Update Decimal (it's now readonly struct)

* fix mcs

* add ROMC.cs

* Fix tests, finish monodroid profile

* Make SRE-not-supported NS2.1 compatible

* Make monotouch_tv and watch NS2.1 compatible

* make some SRE types more NS21 compatible (non-abstract now)

* bump corefx

* More NS21 fixes

* bump coreclr acceptance tests

* Bump API snapshot submodule

* [csproj] Update project files
2019-03-06 08:55:16 +01:00
Alexander Köplinger b31a445e85 [gitattributes] Do CRLF normalization on sln/proj files
They can be used with native line endings.

We now have a shared folder with the dotnet repos and they have CRLF normalization enabled.
This difference leads to conflicts while applying changes from the dotnet repos to mono.
2019-03-06 08:34:01 +01:00
Maxim Lipnin ed0d055424 Throw InvalidOperationException if inner handler is not assigned 2019-03-02 02:31:54 +01:00
Alexander Köplinger 5bf74a9954 [System.Net.Http] Move NSUrlSessionHandler from xamarin-macios to mono (#13229)
* [System.Net.Http] Move NSUrlSessionHandler from xamarin-macios to mono

This allows us to remove the need for a special custom System.Net.Http.dll
build in the xamarin-macios repository.

Part of #11397

* Bump API snapshot submodule

* [csproj] Update project files
2019-03-01 12:20:27 +01:00
Ludovic Henry a685cf26a4 [ci] Add new mode of execution for nunit tests on Android (#13098)
* [ci] Add new mode of execution for nunit tests on Android

This makes it possible to run the `nunit-lite-console.exe` on the host, while the tests still run on the device. This makes it transparent wherever the tests are running, giving us a seamless integration with the existing infrastructure based around nunit.

* [android] Fix System.Net.Http test suite

* [android] Fix System.ServiceModel.Web test suite

* [android] Fix Mono.Security test suite

* fixup! [ci] Add new mode of execution for nunit tests on Android

* [ci] Disable failing tests

* [csproj] Update project files
2019-02-26 22:08:01 +01:00
Martin Baulig 7277e3bb5e SslStream improvements and tests
* Add server-side Server-Name-Indication (SNI) support (both AppleTls and BTLS).

* Support the new `SslServerAuthenticationOptions.ServerCertificateSelectionCallback`.

* Server certificate selection is now compatible with CoreFx behavior; first
  checking the new `ServerCertSelectionDelegate` then `LocalCertSelectionCallback`
  and finally using an explicitly provided certificate.

* Misc exception checks and fixes to make behavior consistent with CoreFx;
  any exception thrown by reading / writing the underlying stream will now be
  propagated verbatim (and not wrapped in an `AuthenticationException`);
  exceptions thrown by the handshake / TLS stack itself will still be wrapped.

* Added `System.Net.Security` xUnit tests from CoreFx.

* Misc test cleanups; moved certificate test files from `System.Net.Http` into
  `System` and embed them in the test assembly as resources, adjusting
  `test-helpers/Configuration.Certificates.cs` accordingly.
2019-02-21 20:43:25 +01:00
Martin Baulig 23762efca5 Add temporary workaround for internal StreamContent constructor. 2019-02-19 23:19:07 +01:00
Alexander Köplinger 9e8317f877 [System.Net.Http] Improve HttpClientTest to use the retry http listener (#12994)
It was missed in https://github.com/mono/mono/pull/11829 so we were still manually
creating HttpListeners which are not hardened against "Address already in use".

Should fix/improve https://github.com/xamarin/maccore/issues/1407.
2019-02-14 11:32:12 +01:00
Alexander Köplinger 260cc5411d Fix tarball build 2019-02-01 23:15:00 +01:00
Alexander Köplinger 2d715b1af2 Fix tarball build 2019-02-01 20:59:54 +01:00
Martin Baulig 2f411750ac "Imperial Red": Bring HttpClient from CoreFx (#11906)
This brings `System.Net.Http` from CoreFx.

It is currently only enabled on Desktop Mac and Linux; Mobile is coming shortly.
2019-02-01 14:09:30 +01:00
Sebastien Pouliot d9508b8086 [System.Net.Http] Fix CFNetworkHandler when no data is sent
The handler receive an `Open` and the a `Close` event but never a
`DataAvailable` event.

So it _hangs_ if only a `200` status is received (since the headers
are not considered _data_) received from the web server.

This is because some initialization only occurs inside
`HandleHasBytesAvailableEvent` which is now called, on `Close`,
to ensure the initialization is done before completing the request.

This, along with a cancellation check, makes the test case from
https://github.com/xamarin/xamarin-macios/issues/5190 work properly
with this handler.

Fixes https://github.com/xamarin/xamarin-macios/issues/5289
2019-01-23 14:36:20 +01:00
monojenkins caf22d5f0b [csproj] Update project files 2019-01-02 13:54:08 +01:00
Manuel de la Pena 5ce08b8433 Minor style changes. 2018-12-21 13:12:53 +01:00
Manuel de la Pena 5c2267c5a7 Fix error while chaging the request :/ 2018-12-21 13:12:53 +01:00
Manuel de la Pena 2bb9a2b39a Small typo. 2018-12-21 13:12:53 +01:00
Manuel de la Pena 4194c31994 No need to close the obc, it can be reused. 2018-12-21 13:12:53 +01:00
Manuel de la Pena a35d921f81 [Network] Fix CVE 2018-8292 on Mac OS X.
This commit ensures that CVE 2018-8292 is fixed by not setting
auto-redirect in the first request done by CFNetwork. CFNetwork has the
same bug, but we can work around it by performing the first request,
checking the response and, if it is a rediret, follow it without the
Authorization headers.
2018-12-21 13:12:53 +01:00
Larry Ewing 3d64ae0618 Allow urls with a blob scheme to pass validation in WASM (#12121)
Relax HttpMessageRequest url scheme validation for wasm so that urls with a blob scheme make it to the host backend. Fixes #11681

note: the browser tests fail when running chrome 71 in headless mode, they work in chrome 70 and 72
2018-12-20 13:14:39 +01:00
Vlad Brezae 9cf13ee9e5 [interp] Enable System.Data tests on fullaotinterp (#11798)
* [interp] Enable System.Data tests on fullaotinterp

* [csproj] Update project files
2018-11-28 15:50:01 +02:00
Kenneth Pouncey 521b8a0b3c [wasm] Make WasmHttpMessageHandler the default handler for WebAssembly (#11631)
* Clean up leaks in the WasmHttpMessageHandler.

- Most of the leaks present themselves during a Cancel of a streaming request.

* Make WasmHttpMessageHandler the default handler for WebAssembly

-  Required libraries WebAssembly.Net.Http.dll and WebAssembly.Bindings.dll.

* Clean up spacing
2018-11-11 22:00:18 -05:00