Граф коммитов

22 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Manuel de la Pena ea1ca3dd5f
[Foundation] Expose the usage of cellular data in the NSUrlSessionHandler. (#6921)
* [foundation] Expose AllowsCellularAccess on NSUrlSessionHandler (#6059)

This property was always set to `true` but it can be useful to turn it
off (and that was not easy with the existing implementation)

* [Foundation] Ensure that we allow celullar data by default until the user says otherwise. #6762

The default value in the NSUrlSession is to allow cellular data. This
small change closes the issue, since users will not have an unexpected
result.

Later we need to provide a proper fix to allow the property to be
exposed AND used the value of the session.

Fixes: https://github.com/xamarin/xamarin-macios/issues/6762
2019-09-05 19:11:30 -04:00
Manuel de la Pena 4a08c6c7b2
[Foundation] Ensure that we allow celullar data by default until the user says otherwise. #6762 (#6916)
* [Foundation] Ensure that we allow celullar data by default until the user says otherwise. #6762

The default value in the NSUrlSession is to allow cellular data. This
small change closes the issue, since users will not have an unexpected
result.

Later we need to provide a proper fix to allow the property to be
exposed AND used the value of the session.

Fixes: https://github.com/xamarin/xamarin-macios/issues/6762
2019-09-05 16:03:10 -04:00
Sebastien Pouliot 4a704e448e
[httpclient] Change NSUrlSessionHandler and CFNetworkHandler to throw HttpRequestException. Fix #6439 (#6477)
Our 3 different handlers were inconsistent with each others. Only the
managed version, `HttpClientHandler`, was throwing the documented
`HttpRequestException` exception.

The inconsistency make this hard to consume from .net standard libraries
even more when the type is not, itself, available in .net standard

stack trace (for NSUrlSessionHandler)

```
2019-07-02 10:58:08.352 gh6439[18579:15880723] System.Net.WebException: The Internet connection appears to be offline. ---> Foundation.NSErrorException: Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x283b6d350 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <55894EBD-B898-4803-9981-46317EEFE280>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <55894EBD-B898-4803-9981-46317EEFE280>.<1>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://www.microsoft.com/fr-ca/, NSErrorFailingURLKey=https://www.microsoft.com/fr-ca/, _kCFStreamErrorDomainKey=1}
   --- End of inner exception stack trace ---
  at System.Net.Http.NSUrlSessionHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x001d4] in /Users/poupou/git/xcode11/xamarin-macios/src/Foundation/NSUrlSessionHandler.cs:541
  at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x0009e] in /Users/poupou/git/xcode11/xamarin-macios/external/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:281
```

stack trace (for CFNetworkHandler)

```
2019-07-02 11:04:35.407 gh6439[18580:15881497] CoreFoundation.CFException: The operation couldn’t be completed. Network is down
  at System.Net.Http.CFNetworkHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken, System.Boolean isFirstRequest) [0x002f2] in /Users/poupou/git/xcode11/xamarin-macios/src/System.Net.Http/CFNetworkHandler.cs:266
  at System.Net.Http.CFNetworkHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00034] in /Users/poupou/git/xcode11/xamarin-macios/src/System.Net.Http/CFNetworkHandler.cs:199
  at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x0009e] in /Users/poupou/git/xcode11/xamarin-macios/external/mono/mcs/class/System.Net.Http/System.Net.Http/HttpClient.cs:281
```

references:
* https://github.com/xamarin/xamarin-macios/issues/6439
* https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.postasync?view=netstandard-2.0#System_Net_Http_HttpClient_PostAsync_System_String_System_Net_Http_HttpContent_System_Threading_CancellationToken_
2019-07-04 09:50:27 -04:00
monojenkins 9b9e57b80d [monotouch-test] Ignore MessageHandlerTest.RejectSslCertificatesServicePointManager on macOS 10.10. (#6219)
This works around (but doesn't fix) https://github.com/xamarin/maccore/issues/1645.
2019-06-07 14:25:26 -07:00
Rolf Bjarne Kvinge 6be7597912
[monotouch-test] Ignore MessageHandlerTest.RejectSslCertificatesServicePointManager on macOS 10.10. (#6181)
This works around (but doesn't fix) https://github.com/xamarin/maccore/issues/1645.
2019-05-30 12:45:58 -07:00
Manuel de la Pena 2a42a35ba4
[Tests] Ensure that if trsut exception is not raised we do not get a NRE. (#6130)
This might be a race issue when dealing with the trust of the certs,
there is not much information in
https://github.com/xamarin/maccore/issues/1645 except the fact that we
are getting a null exception.

In this fix, we will first ensure that we did get the exception, later
confirm the exception type. To improve the debugging of the test, next
time it fails, we will get the content string to try and understand what
happened with the validation (did we return part of the stream or
headers when we shouldn't?)
2019-05-24 07:28:08 -07:00
monojenkins f08d4e3ea8 [d16-2] [foundation] Add custom trust/certificate validation to NSUrlSessionHandler. Fix #4170 (#6110)
Basic application (size) for doing an `HttpClient.GetAsync`, release/llvm, 64bits only

- NSUrlSessionHandler (master): 6.4 MB
- NSUrlSessionHandler (PR#5936): 7.7 MB
- NSUrlSessionHandler (this PR): 6.4 MB

The size increase occurs because of the reference to .net `X509*` types.
This brings a lot of additional code, including managed cryptographic
code, inside the application - even when the feature is **not** used.

The solution is to expose an API that only use native (OS) types, which
are mostly already part of the application. This has a very low impact
on existing applications.

It's still possible to hook back to .NET validation if needed (it should
not in most cases) but, in this case, the extra price will only be
_paid_ if used (and can be lower if the code is needed by something else
from the application).

In comparison using other `HttpClient` handler produce app sizes of

- HttpClientHandler (managed): 10.4 MB
- CFNetworkHandler: 6.8 MB

Based on/supersede https://github.com/xamarin/xamarin-macios/pull/5733
Fix https://github.com/xamarin/xamarin-macios/issues/4170
2019-05-23 09:51:42 -05:00
Sebastien Pouliot 54e6940cbe
[foundation] Add custom trust/certificate validation to NSUrlSessionHandler. Fix #4170 (#6103)
Basic application (size) for doing an `HttpClient.GetAsync`, release/llvm, 64bits only

- NSUrlSessionHandler (master): 6.4 MB
- NSUrlSessionHandler (PR#5936): 7.7 MB
- NSUrlSessionHandler (this PR): 6.4 MB

The size increase occurs because of the reference to .net `X509*` types.
This brings a lot of additional code, including managed cryptographic
code, inside the application - even when the feature is **not** used.

The solution is to expose an API that only use native (OS) types, which
are mostly already part of the application. This has a very low impact
on existing applications.

It's still possible to hook back to .NET validation if needed (it should
not in most cases) but, in this case, the extra price will only be
_paid_ if used (and can be lower if the code is needed by something else
from the application).

In comparison using other `HttpClient` handler produce app sizes of

- HttpClientHandler (managed): 10.4 MB
- CFNetworkHandler: 6.8 MB

Based on/supersede https://github.com/xamarin/xamarin-macios/pull/5733
Fix https://github.com/xamarin/xamarin-macios/issues/4170
2019-05-23 08:09:10 -04:00
Manuel de la Pena a5232f8c5e
[Tests] Make test inconclusive if httpbin does not return the headers. (#5684)
In some cases, httpbin might return errors or other results. In that
case, we cannot assert that the auth headers are not present. We set the
test to inconclusive to ensure that we do not fail due to the external
page.

Fixes https://github.com/xamarin/maccore/issues/1453
2019-02-28 15:35:36 +01:00
Manuel de la Pena e470035431
[Tests] Add some extra info to better debug next time test fails. (#5598)
We have issue https://github.com/xamarin/maccore/issues/701 that states
that there is no exception. Get the received response to check against
null and help debug the issue next time it happens in the CI bots.
2019-02-13 12:22:24 +01:00
Manuel de la Pena 46728f0c6e
[Tests] Do not fail with timeouts. Fixes #1332 (#5596)
The bots sometimes have issues with the network. We do not want red
builds due to a problem in the connection. Lets set the test to
inclonclusive since we cannot assert the headers that have been sent.

Fixes https://github.com/xamarin/maccore/issues/1332
2019-02-12 19:27:23 +01:00
Manuel de la Pena 81ea2e3e46
[Network] Add test to ensure that auth headers are not fwd on redirects. (#5371) 2019-01-10 17:45:20 +01:00
Manuel de la Pena fb4147d78d
[Foundation] Make sure we use the cookies from the cookie storage. Fixes #5148 (#5244)
The response object does not have all the cookie values, instead we must
rust the cookie storage which can be used to retrieve ALL the cookies
for a task.

The header value has to be created manually because the native objects
do not expose a valid way to get the header. Tests have been added to
ensure we return the same as the managed client.

Fixes https://github.com/xamarin/xamarin-macios/issues/5148
2018-12-10 22:59:11 +01:00
Rolf Bjarne Kvinge c814ddb567
[monotouch-test] Tweak DnsFailure a bit. (#5208)
* Make it clearer when a timeout happens that a timeout happened by asserting
  exactly that.
* Don't assert after getting the (unexpected) result from the network request,
  since asserting will throw an exception, which will be caught and stored,
  and then later in the test we assert that an exception was thrown. So
  asserting just after a successful network request effectively hides any
  failures, since we're now passing because of the assertion exception. Ops.
2018-12-03 17:43:58 +01:00
Rolf Bjarne Kvinge 1b32a8dba5
[monotouch-test] Improve diagnostic output when MessageHandlerTest fails. (#5085)
Reference: https://github.com/xamarin/xamarin-macios/issues/4013
2018-11-06 09:57:35 +01:00
Rolf Bjarne Kvinge 1b12348e57 [tests] Refactor API to check/assert current OS version. 2018-07-04 12:35:15 +02:00
Rolf Bjarne Kvinge 9703f17c91 [monotouch-test] Fix versions checks.
* Fix many version checks to be based on Xcode version instead of iOS version.
* Added/fixed a few expected values according to platform version to match behavior in older macOS versions.
2018-07-03 20:47:14 +02:00
Manuel de la Pena 9b9ffa2d52 [Tests] Reenable dns tests on the watch. (#2674) 2017-09-14 10:10:15 -04:00
Manuel de la Pena 6ee7f5aae2 [Tests] add a work around to fix #57762 until bug #57825 is done. (#2300)
* [Tests] add a work around to fix 57762 until bug #57825 is done.

* Update comment with correct bug.

* Fix tests for watchos.

* Skip on watch.
2017-07-13 08:24:36 -04:00
Timothy Risi 687aa6f25f Port monotouch-test suite to Xamarin.Mac (#1445)
* Port the Monotouch-test suite to run on Xamarin.Mac

Adds over 1300 new API tests for XM
2017-01-12 09:13:56 -09:00
Rolf Bjarne Kvinge 10516d3672 [CoreFoundation] Store strings in the exception data when converting CFError to CFException. Fixes #46626. (#1144)
Store strings in the exception data when converting CFError to CFException, to
make sure the data stored is serializable (which is apparently a requirement
with the reference sources).

https://bugzilla.xamarin.com/show_bug.cgi?id=46626
2016-11-09 15:31:02 +01:00