Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
74395f2
Create AndroidMessageHandler and restructure AndroidClientHander to c…
Jul 2, 2021
75640fe
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Jul 5, 2021
fbb785b
Update .apkdesc files
jonathanpeppers Jul 6, 2021
6673114
Merge remote-tracking branch 'upstream/main' into intro-android-messa…
Jul 8, 2021
f7498ba
Use reflection to get underlying handler from AndroidClientHandler
Jul 8, 2021
5118b6e
Split AndroidClientHandler between net6 and legacy. Excluded Compile…
Jul 9, 2021
5062dd8
[tests] Make it easier to repro dotnet/runtime#55375
jonpryor Jul 9, 2021
004725d
[tests] Disable linking on Mono.Android.NET-Tests.csproj
jonpryor Jul 9, 2021
23310da
Revert "[tests] Disable linking on Mono.Android.NET-Tests.csproj"
jonpryor Jul 9, 2021
cd67d24
Revert "[tests] Make it easier to repro dotnet/runtime#55375"
jonpryor Jul 9, 2021
ac1385f
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Jul 12, 2021
b6bdde3
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Jul 19, 2021
a0ba2ad
Merge branch 'main' into darc-main-ad9c41ae-32fa-4740-9606-7b7e381226b3
jonathanpeppers Jul 19, 2021
813104f
[xaprepare] always delete ~/android-toolchain/dotnet
jonathanpeppers Jul 19, 2021
0ea4acf
Merge remote-tracking branch 'steve/intro-android-messagehandler' int…
jonathanpeppers Jul 19, 2021
4d3682a
Remove $(SelfContained) = true by default
jonathanpeppers Jul 19, 2021
3faed48
Bump to xamarin/java.interop/main@4fb7c147
jonathanpeppers Jul 19, 2021
d2211ba
Update .apkdesc files
jonathanpeppers Jul 20, 2021
2a2dbd7
Merge branch 'main' into darc-main-ad9c41ae-32fa-4740-9606-7b7e381226b3
jonathanpeppers Jul 20, 2021
6ff64d6
Fixes for AndroidClientHandler.GetUnderlyingHandler()
jonathanpeppers Jul 20, 2021
3929b66
Add [DynamicDependency] for AndroidClientHandler.GetUnderlyingHandler()
jonathanpeppers Jul 20, 2021
5fe4176
Merge branch 'main' into darc-main-ad9c41ae-32fa-4740-9606-7b7e381226b3
jonathanpeppers Jul 20, 2021
f309531
[tests] System.IO.FileSystem.dll no longer exists
jonathanpeppers Jul 20, 2021
f462738
Address PR comments
jonathanpeppers Jul 20, 2021
f957c82
Add default settings for AndroidMessageHandler
jonathanpeppers Jul 20, 2021
04b67b4
[tests] changes for AndroidClientHandlerTests to pass
jonathanpeppers Jul 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[tests] changes for AndroidClientHandlerTests to pass
* MaxAutomaticRedirections should throw if <= 0
* UseCookies defaults to true
* CookieContainer creates a new instance on first call
* Catch TargetInvocationException, see: dotnet/runtime#56089
* Catch PlatformNotSupportedException for ClientCertificateOptions
  • Loading branch information
jonathanpeppers committed Jul 21, 2021
commit 04b67b43670ed7fb3392bd52dadf3f20e0fd505d
22 changes: 16 additions & 6 deletions src/Mono.Android/Xamarin.Android.Net/AndroidMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ sealed class RequestRedirectionState
internal const bool SupportsProxy = true;
internal const bool SupportsRedirectConfiguration = true;

public bool UseCookies { get; set; }

public DecompressionMethods AutomaticDecompression
{
get => _decompressionMethods;
Expand All @@ -84,13 +82,11 @@ public DecompressionMethods AutomaticDecompression

public CookieContainer CookieContainer
{
get => _cookieContainer;
get => _cookieContainer ?? (_cookieContainer = new CookieContainer ());
set
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}

_cookieContainer = value;
}
Expand All @@ -99,6 +95,8 @@ public CookieContainer CookieContainer
// NOTE: defaults here are based on:
// https://github.com/dotnet/runtime/blob/ccfe21882e4a2206ce49cd5b32d3eb3cab3e530f/src/libraries/Common/src/System/Net/Http/HttpHandlerDefaults.cs

public bool UseCookies { get; set; } = true;

public bool PreAuthenticate { get; set; } = false;

public bool UseProxy { get; set; } = true;
Expand All @@ -109,7 +107,19 @@ public CookieContainer CookieContainer

public bool AllowAutoRedirect { get; set; } = true;

public int MaxAutomaticRedirections { get; set; } = 50;
int maxAutomaticRedirections = 50;

public int MaxAutomaticRedirections
{
get => maxAutomaticRedirections;
set {
// https://github.com/dotnet/runtime/blob/913facdca8b04cc674163e31a7650ef6868a7d5b/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpHandler.cs#L142-L145
if (value <= 0)
throw new ArgumentOutOfRangeException(nameof(value), value, "The specified value must be greater than 0");

maxAutomaticRedirections = value;
}
}

/// <summary>
/// <para>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ public void Properties_Defaults ()
Assert.IsTrue (h.UseCookies, "#12");
Assert.IsFalse (h.UseDefaultCredentials, "#13");
Assert.IsTrue (h.UseProxy, "#14");
Assert.AreEqual (ClientCertificateOption.Manual, h.ClientCertificateOptions, "#15");
try {
Assert.AreEqual (ClientCertificateOption.Manual, h.ClientCertificateOptions, "#15");
} catch (PlatformNotSupportedException) {
// https://github.com/dotnet/runtime/blob/07336810acf3b4e7bdd0fb7da87b54920ea9c382/src/libraries/System.Net.Http/src/System/Net/Http/HttpClientHandler.AnyMobile.cs#L310-L314
}
}

[Test]
Expand All @@ -99,12 +103,16 @@ public void Properties_Invalid ()
h.MaxAutomaticRedirections = 0;
Assert.Fail ("#1");
} catch (ArgumentOutOfRangeException) {
} catch (TargetInvocationException) {
// See: https://github.com/dotnet/runtime/issues/56089
}

try {
h.MaxRequestContentBufferSize = -1;
Assert.Fail ("#2");
} catch (ArgumentOutOfRangeException) {
} catch (TargetInvocationException) {
// See: https://github.com/dotnet/runtime/issues/56089
}
}

Expand Down