Skip to content

Commit

Permalink
Use AndroidClientHandler to attempt to avert #777
Browse files Browse the repository at this point in the history
Fixes #795
  • Loading branch information
borrrden committed Jan 6, 2017
1 parent c0f1418 commit d550c7d
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public CouchbaseLiteHttpClientFactory()
internal static void SetupSslCallback()
{
// Disable SSL 3 fallback to mitigate POODLE vulnerability.
ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;
ServicePointManager.SecurityProtocol &= ~System.Net.SecurityProtocolType.Ssl3;
ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls;

if(ServicePointManager.ServerCertificateValidationCallback != null)
{
if(ServicePointManager.ServerCertificateValidationCallback != null) {
return;
}

Expand Down Expand Up @@ -143,10 +143,23 @@ internal static void SetupSslCallback()
internal HttpMessageHandler BuildHandlerPipeline (CookieStore store, IRetryStrategy retryStrategy)
{
#if __MOBILE__
var handler = new HttpClientHandler {
CookieContainer = store,
UseCookies = true
};
var handler = default(HttpClientHandler);
#if __ANDROID__
if (global::Android.OS.Build.VERSION.SdkInt >= global::Android.OS.BuildVersionCodes.Lollipop) {
handler = new Xamarin.Android.Net.AndroidClientHandler
{
CookieContainer = store,
UseCookies = true
};
} else
#endif
{
handler = new HttpClientHandler
{
CookieContainer = store,
UseCookies = true
};
}
#else
var handler = new WebRequestHandler {
CookieContainer = store,
Expand Down
8 changes: 8 additions & 0 deletions src/Couchbase.Lite.iOS.Tests/Couchbase.Lite.iOS.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@
<Reference Include="SQLitePCL.ugly">
<HintPath>..\packages\SQLitePCL.ugly.0.9.3\lib\portable-net45+netcore45+wp8+MonoAndroid10+MonoTouch10+Xamarin.iOS10\SQLitePCL.ugly.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions.Core">
<HintPath>..\packages\FluentAssertions.4.18.0\lib\netstandard1.3\FluentAssertions.Core.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions">
<HintPath>..\packages\FluentAssertions.4.18.0\lib\netstandard1.3\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
Expand Down
47 changes: 47 additions & 0 deletions src/Couchbase.Lite.iOS.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentAssertions" version="4.18.0" targetFramework="xamarinios10" />
<package id="Jint" version="2.8" targetFramework="xamarinios10" />
<package id="Microsoft.NETCore.Platforms" version="1.0.1" targetFramework="xamarinios10" />
<package id="Microsoft.Win32.Primitives" version="4.0.1" targetFramework="xamarinios10" />
<package id="NETStandard.Library" version="1.6.0" targetFramework="xamarinios10" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="xamarinios10" />
<package id="SharpZipLib.Portable" version="0.86.0.0003" targetFramework="xamarinios10" />
<package id="SQLitePCL.plugin.sqlcipher.ios_unified" version="0.9.3" targetFramework="xamarinios10" />
<package id="SQLitePCL.raw" version="0.9.3" targetFramework="xamarinios10" />
<package id="SQLitePCL.ugly" version="0.9.3" targetFramework="xamarinios10" />
<package id="Stateless" version="2.5.62.0" targetFramework="xamarinios10" />
<package id="System.AppContext" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Collections" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Collections.Concurrent" version="4.0.12" targetFramework="xamarinios10" />
<package id="System.Console" version="4.0.0" targetFramework="xamarinios10" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Diagnostics.Tools" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Diagnostics.Tracing" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Globalization" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Globalization.Calendars" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.IO" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.IO.Compression" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.IO.Compression.ZipFile" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.IO.FileSystem" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.IO.FileSystem.Primitives" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Linq" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Linq.Expressions" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Net.Http" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Net.Primitives" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Net.Sockets" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.ObjectModel" version="4.0.12" targetFramework="xamarinios10" />
<package id="System.Reflection" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Reflection.Extensions" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Reflection.Primitives" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Reflection.TypeExtensions" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Resources.ResourceManager" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Runtime" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Runtime.Extensions" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Runtime.Handles" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Runtime.InteropServices" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0" targetFramework="xamarinios10" />
<package id="System.Runtime.Numerics" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Security.Cryptography.Algorithms" version="4.2.0" targetFramework="xamarinios10" />
<package id="System.Security.Cryptography.Encoding" version="4.0.0" targetFramework="xamarinios10" />
<package id="System.Security.Cryptography.Primitives" version="4.0.0" targetFramework="xamarinios10" />
<package id="System.Security.Cryptography.X509Certificates" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Text.Encoding" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Text.Encoding.Extensions" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Text.RegularExpressions" version="4.1.0" targetFramework="xamarinios10" />
<package id="System.Threading" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Threading.Tasks" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Threading.Timer" version="4.0.1" targetFramework="xamarinios10" />
<package id="System.Xml.ReaderWriter" version="4.0.11" targetFramework="xamarinios10" />
<package id="System.Xml.XDocument" version="4.0.11" targetFramework="xamarinios10" />
</packages>

0 comments on commit d550c7d

Please sign in to comment.