diff --git a/.gitignore b/.gitignore index 6cb1b14..4cd80ae 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ build/ build/ *.xam packages +*.user +*.bak +*.suo diff --git a/ModernHttpClient.sln b/ModernHttpClient.sln index d3f45ce..9100e1e 100644 --- a/ModernHttpClient.sln +++ b/ModernHttpClient.sln @@ -1,8 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernHttpClient.iOS", "src\ModernHttpClient\ModernHttpClient.iOS.csproj", "{0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}" -EndProject +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernHttpClient.Android", "src\ModernHttpClient\ModernHttpClient.Android.csproj", "{F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Playground.Android", "src\Playground.Android\Playground.Android.csproj", "{90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}" @@ -15,36 +15,83 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModernHttpClient.iOS64", "s EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Ad-Hoc|Any CPU = Ad-Hoc|Any CPU + Ad-Hoc|iPhone = Ad-Hoc|iPhone + Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator + AppStore|Any CPU = AppStore|Any CPU + AppStore|iPhone = AppStore|iPhone + AppStore|iPhoneSimulator = AppStore|iPhoneSimulator Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|iPhoneSimulator = Debug|iPhoneSimulator - Release|iPhoneSimulator = Release|iPhoneSimulator Debug|iPhone = Debug|iPhone + Debug|iPhoneSimulator = Debug|iPhoneSimulator + Release|Any CPU = Release|Any CPU Release|iPhone = Release|iPhone - Ad-Hoc|iPhone = Ad-Hoc|iPhone - AppStore|iPhone = AppStore|iPhone + Release|iPhoneSimulator = Release|iPhoneSimulator EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.AppStore|iPhone.Build.0 = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Debug|iPhone.Build.0 = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Release|Any CPU.Build.0 = Release|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Release|iPhone.ActiveCfg = Release|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Release|iPhone.Build.0 = Release|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {0F2A1CC8-4168-4CB4-B334-28C28BA51ECB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|Any CPU.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|iPhone.Build.0 = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhone.Build.0 = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|Any CPU.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhone.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhone.Build.0 = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|Any CPU.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|Any CPU.Deploy.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhone.Build.0 = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhone.Build.0 = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|Any CPU.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhone.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhone.Build.0 = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {2CE837CD-9B97-4058-9156-339697EEE228}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhoneSimulator {2CE837CD-9B97-4058-9156-339697EEE228}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone {2CE837CD-9B97-4058-9156-339697EEE228}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone + {2CE837CD-9B97-4058-9156-339697EEE228}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator + {2CE837CD-9B97-4058-9156-339697EEE228}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator + {2CE837CD-9B97-4058-9156-339697EEE228}.AppStore|Any CPU.ActiveCfg = AppStore|iPhoneSimulator {2CE837CD-9B97-4058-9156-339697EEE228}.AppStore|iPhone.ActiveCfg = AppStore|iPhone {2CE837CD-9B97-4058-9156-339697EEE228}.AppStore|iPhone.Build.0 = AppStore|iPhone + {2CE837CD-9B97-4058-9156-339697EEE228}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator + {2CE837CD-9B97-4058-9156-339697EEE228}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator {2CE837CD-9B97-4058-9156-339697EEE228}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator {2CE837CD-9B97-4058-9156-339697EEE228}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator {2CE837CD-9B97-4058-9156-339697EEE228}.Debug|iPhone.ActiveCfg = Debug|iPhone @@ -57,26 +104,18 @@ Global {2CE837CD-9B97-4058-9156-339697EEE228}.Release|iPhone.Build.0 = Release|iPhone {2CE837CD-9B97-4058-9156-339697EEE228}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {2CE837CD-9B97-4058-9156-339697EEE228}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|iPhone.Build.0 = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhone.Build.0 = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|Any CPU.Build.0 = Release|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhone.ActiveCfg = Release|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhone.Build.0 = Release|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.AppStore|Any CPU.Build.0 = Debug|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.AppStore|iPhone.ActiveCfg = Release|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.AppStore|iPhone.Build.0 = Release|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6DD98593-4498-463D-B16E-F6CC5A928B79}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Debug|Any CPU.Build.0 = Debug|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -89,45 +128,40 @@ Global {6DD98593-4498-463D-B16E-F6CC5A928B79}.Release|iPhone.Build.0 = Release|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {6DD98593-4498-463D-B16E-F6CC5A928B79}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.AppStore|iPhone.Build.0 = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|Any CPU.Build.0 = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhone.Build.0 = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|Any CPU.ActiveCfg = Release|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|Any CPU.Build.0 = Release|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhone.ActiveCfg = Release|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhone.Build.0 = Release|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {90F8D67C-8D81-4DCE-BAE7-1ABA136A4C60}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|iPhone.ActiveCfg = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.AppStore|iPhone.Build.0 = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhone.Build.0 = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|Any CPU.Build.0 = Release|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhone.ActiveCfg = Release|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhone.Build.0 = Release|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {F7290B9E-C821-4DA7-A4E5-824D9B0F70F2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|Any CPU.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|Any CPU.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|iPhone.ActiveCfg = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|iPhone.Build.0 = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhone.Build.0 = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|Any CPU.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhone.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhone.Build.0 = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {6941F069-AC02-40EE-BBF3-9FE3331030EF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 $0.DotNetNamingPolicy = $1 $1.DirectoryNamespaceAssociation = PrefixedHierarchical $1.ResourceNamePolicy = FileFormatDefault - $0.TextStylePolicy = $2 + $0.TextStylePolicy = $4 $2.inheritsSet = null $2.scope = text/x-csharp $0.CSharpFormattingPolicy = $3 @@ -150,7 +184,6 @@ Global $3.inheritsSet = Mono $3.inheritsScope = text/x-csharp $3.scope = text/x-csharp - $0.TextStylePolicy = $4 $4.FileWidth = 120 $4.inheritsSet = VisualStudio $4.inheritsScope = text/plain diff --git a/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs b/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs index 6839410..9c1c867 100644 --- a/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs +++ b/src/ModernHttpClient/Android/OkHttpNetworkHandler.cs @@ -1,23 +1,26 @@ using System; -using System.Threading; -using System.Threading.Tasks; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; -using Square.OkHttp; -using Javax.Net.Ssl; using System.Text.RegularExpressions; -using Java.IO; +using System.Threading; +using System.Threading.Tasks; using System.Security.Cryptography.X509Certificates; -using System.Globalization; -using Android.OS; + +using Java.Interop; +using Javax.Net.Ssl; +using Java.Security; +using Java.Security.Cert; + +using Square.OkHttp3; +using Java.IO; namespace ModernHttpClient { - public class NativeMessageHandler : HttpClientHandler + public class NativeMessageHandler : HttpClientHandler { - readonly OkHttpClient client = new OkHttpClient(); + readonly OkHttpClient client; readonly CacheControl noCacheCacheControl = default(CacheControl); readonly bool throwOnCaptiveNetwork; @@ -36,11 +39,25 @@ public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerificati { this.throwOnCaptiveNetwork = throwOnCaptiveNetwork; - if (customSSLVerification) client.SetHostnameVerifier(new HostnameVerifier()); - noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); + if (customSSLVerification) + { + var tm = new CustomX509TrustManager(); + var sslCtx = SSLContext.GetInstance("TLSv1.2"); + sslCtx.Init(null, new ITrustManager[] { tm }, null); + + client = new OkHttpClient.Builder() + .HostnameVerifier(new HostnameVerifier()) + .SslSocketFactory(sslCtx.SocketFactory, tm) + .Build(); + } + else + client = new OkHttpClient(); + + + noCacheCacheControl = (new CacheControl.Builder()).NoCache().Build(); } - public void RegisterForProgress(HttpRequestMessage request, ProgressDelegate callback) + public void RegisterForProgress(HttpRequestMessage request, ProgressDelegate callback) { if (callback == null && registeredProgressCallbacks.ContainsKey(request)) { registeredProgressCallbacks.Remove(request); @@ -77,7 +94,7 @@ string getHeaderSeparator(string name) return ","; } - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var java_uri = request.RequestUri.GetComponents(UriComponents.AbsoluteUri, UriFormat.UriEscaped); var url = new Java.Net.URL(java_uri); @@ -106,7 +123,8 @@ protected override async Task SendAsync(HttpRequestMessage (IEnumerable>>)request.Content.Headers : Enumerable.Empty>>()); - foreach (var kvp in keyValuePairs) builder.AddHeader(kvp.Key, String.Join(getHeaderSeparator(kvp.Key), kvp.Value)); + foreach (var kvp in keyValuePairs) + builder.AddHeader(kvp.Key, String.Join(getHeaderSeparator(kvp.Key), kvp.Value)); cancellationToken.ThrowIfCancellationRequested(); @@ -116,24 +134,25 @@ protected override async Task SendAsync(HttpRequestMessage // NB: Even closing a socket must be done off the UI thread. Cray! cancellationToken.Register(() => Task.Run(() => call.Cancel())); - var resp = default(Response); - try { - resp = await call.EnqueueAsync().ConfigureAwait(false); - var newReq = resp.Request(); - var newUri = newReq == null ? null : newReq.Uri(); - request.RequestUri = new Uri(newUri.ToString()); - if (throwOnCaptiveNetwork && newUri != null) { - if (url.Host != newUri.Host) { - throw new CaptiveNetworkException(new Uri(java_uri), new Uri(newUri.ToString())); - } - } - } catch (IOException ex) { - if (ex.Message.ToLowerInvariant().Contains("canceled")) { - throw new OperationCanceledException(); - } - - throw; - } + Response resp = null; + try + { + resp = call.Execute(); + //resp = await call.EnqueueAsync().ConfigureAwait(false); + } + catch(Exception ex) + { + System.Console.WriteLine("Exception from EnqueueAsync!\n" + ex.ToString()); + throw; + } + + var newReq = resp.Request(); + var newUri = newReq == null ? null : newReq.Url(); + request.RequestUri = new Uri(newUri.ToString()); + if (throwOnCaptiveNetwork + && newUri != null + && url.Host != newUri.Host()) + throw new CaptiveNetworkException(new Uri(java_uri), new Uri(newUri.ToString())); var respBody = resp.Body(); @@ -160,123 +179,153 @@ protected override async Task SendAsync(HttpRequestMessage } } - public static class AwaitableOkHttp - { - public static Task EnqueueAsync(this Call This) - { - var cb = new OkTaskCallback(); - This.Enqueue(cb); - - return cb.Task; - } - - class OkTaskCallback : Java.Lang.Object, ICallback - { - readonly TaskCompletionSource tcs = new TaskCompletionSource(); - public Task Task { get { return tcs.Task; } } - - public void OnFailure(Request p0, Java.IO.IOException p1) - { - // Kind of a hack, but the simplest way to find out that server cert. validation failed - if (p1.Message == String.Format("Hostname '{0}' was not verified", p0.Url().Host)) { - tcs.TrySetException(new WebException(p1.LocalizedMessage, WebExceptionStatus.TrustFailure)); - } else { - tcs.TrySetException(p1); - } - } - - public void OnResponse(Response p0) - { - tcs.TrySetResult(p0); - } - } - } - - class HostnameVerifier : Java.Lang.Object, IHostnameVerifier + public static class AwaitableOkHttp + { + public static Task EnqueueAsync(this ICall This) + { + var cb = new OkTaskCallback(); + This.Enqueue(cb); + + return cb.Task; + } + + class OkTaskCallback : Java.Lang.Object, ICallback + { + readonly TaskCompletionSource tcs = new TaskCompletionSource(); + public Task Task { get { return tcs.Task; } } + + public void OnFailure(ICall p0, IOException p1) + { + // Kind of a hack, but the simplest way to find out that server cert. validation failed + if (p1.Message == String.Format("Hostname '{0}' was not verified", p0.Request().Url().Host())) + { + tcs.TrySetException(new WebException(p1.LocalizedMessage, WebExceptionStatus.TrustFailure)); + } + else if (p1.Message.ToLowerInvariant().Contains("canceled")) + { + tcs.TrySetException(new OperationCanceledException()); + } + else + { + tcs.TrySetException(new WebException(p1.Message)); + } + } + + public void OnResponse(ICall p0, Response p1) + { + tcs.TrySetResult(p1); + } + } + } + + internal class HostnameVerifier : Java.Lang.Object, IHostnameVerifier + { + static readonly Regex cnRegex = new Regex(@"CN\s*=\s*([^,]*)", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); + + public bool Verify(string hostname, ISSLSession session) + { + if (ServicePointManager.ServerCertificateValidationCallback == null) + return HttpsURLConnection.DefaultHostnameVerifier.Verify(hostname, session); + + var certificates = session.GetPeerCertificates(); + return Verify(certificates, hostname); + } + + public static bool Verify(Certificate[] certificates, string hostname = null) + { + var chain = new X509Chain(); + X509Certificate2 root = null; + var errors = System.Net.Security.SslPolicyErrors.None; + + // Build certificate chain and check for errors + if (certificates == null || certificates.Length == 0) + {//no cert at all + errors = System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable; + goto bail; + } + + var netCerts = certificates.Select(x => new X509Certificate2(x.GetEncoded())).ToArray(); + + for (int i = 1; i < netCerts.Length; i++) + chain.ChainPolicy.ExtraStore.Add(netCerts[i]); + + root = netCerts[0]; + + chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain; + chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; + chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0); + chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority; + + if (!chain.Build(root)) + { + errors = System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors; + goto bail; + } + + var subject = root.Subject; + var subjectCn = cnRegex.Match(subject).Groups[1].Value; + if (hostname != null) + { + if (String.IsNullOrWhiteSpace(subjectCn) || !Utility.MatchHostnameToPattern(hostname, subjectCn)) + { + errors = System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch; + goto bail; + } + } + else + { + // I don't have the hostname here, so I can't verify it. + // but I can read it from the certificate and use as sender + hostname = subjectCn; + } + + bail: + // Call the delegate to validate + return ServicePointManager.ServerCertificateValidationCallback(hostname, root, chain, errors); + } + } + + internal class CustomX509TrustManager : Java.Lang.Object, IX509TrustManager { - static readonly Regex cnRegex = new Regex(@"CN\s*=\s*([^,]*)", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline); - - public bool Verify(string hostname, ISSLSession session) + private IX509TrustManager defaultTrustManager; + private IX509TrustManager DefaultTrustManager + { + get + { + if(defaultTrustManager == null) + { + var algorithm = TrustManagerFactory.DefaultAlgorithm; + var defaultTrustManagerFactory = TrustManagerFactory.GetInstance(algorithm); + defaultTrustManagerFactory.Init((KeyStore)null); + var trustManagers = defaultTrustManagerFactory.GetTrustManagers(); + defaultTrustManager = trustManagers[0].JavaCast(); + } + return defaultTrustManager; + } + } + + public void CheckClientTrusted(Java.Security.Cert.X509Certificate[] chain, string authType) { - return verifyServerCertificate(hostname, session) & verifyClientCiphers(hostname, session); + // we are the client } - /// - /// Verifies the server certificate by calling into ServicePointManager.ServerCertificateValidationCallback or, - /// if the is no delegate attached to it by using the default hostname verifier. - /// - /// true, if server certificate was verifyed, false otherwise. - /// - /// - static bool verifyServerCertificate(string hostname, ISSLSession session) + public void CheckServerTrusted(Java.Security.Cert.X509Certificate[] certificates, string authType) { - var defaultVerifier = HttpsURLConnection.DefaultHostnameVerifier; - - if (ServicePointManager.ServerCertificateValidationCallback == null) return defaultVerifier.Verify(hostname, session); - - // Convert java certificates to .NET certificates and build cert chain from root certificate - var certificates = session.GetPeerCertificateChain(); - var chain = new X509Chain(); - X509Certificate2 root = null; - var errors = System.Net.Security.SslPolicyErrors.None; - - // Build certificate chain and check for errors - if (certificates == null || certificates.Length == 0) {//no cert at all - errors = System.Net.Security.SslPolicyErrors.RemoteCertificateNotAvailable; - goto bail; - } - - if (certificates.Length == 1) {//no root? - errors = System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors; - goto bail; - } - - var netCerts = certificates.Select(x => new X509Certificate2(x.GetEncoded())).ToArray(); - - for (int i = 1; i < netCerts.Length; i++) { - chain.ChainPolicy.ExtraStore.Add(netCerts[i]); - } - - root = netCerts[0]; - - chain.ChainPolicy.RevocationFlag = X509RevocationFlag.EntireChain; - chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; - chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0); - chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority; - - if (!chain.Build(root)) { - errors = System.Net.Security.SslPolicyErrors.RemoteCertificateChainErrors; - goto bail; - } - - var subject = root.Subject; - var subjectCn = cnRegex.Match(subject).Groups[1].Value; - - if (String.IsNullOrWhiteSpace(subjectCn) || !Utility.MatchHostnameToPattern(hostname, subjectCn)) { - errors = System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch; - goto bail; - } - - bail: - // Call the delegate to validate - return ServicePointManager.ServerCertificateValidationCallback(hostname, root, chain, errors); + if (ServicePointManager.ServerCertificateValidationCallback == null) + { + DefaultTrustManager.CheckServerTrusted(certificates, authType); + } + else + { + var isvalid = HostnameVerifier.Verify(certificates); + if(!isvalid) + throw new Java.Security.Cert.CertificateException("Server certificate is not trusted."); // SSLHandshakeException doesn't work either + } } - /// - /// Verifies client ciphers and is only available in Mono and Xamarin products. - /// - /// true, if client ciphers was verifyed, false otherwise. - /// - /// - static bool verifyClientCiphers(string hostname, ISSLSession session) + Java.Security.Cert.X509Certificate[] IX509TrustManager.GetAcceptedIssuers() { - var callback = ServicePointManager.ClientCipherSuitesCallback; - if (callback == null) return true; - - var protocol = session.Protocol.StartsWith("SSL", StringComparison.InvariantCulture) ? SecurityProtocolType.Ssl3 : SecurityProtocolType.Tls; - var acceptedCiphers = callback(protocol, new[] { session.CipherSuite }); - - return acceptedCiphers.Contains(session.CipherSuite); + return new Java.Security.Cert.X509Certificate[0]; } } } diff --git a/src/ModernHttpClient/ModernHttpClient.Android.csproj b/src/ModernHttpClient/ModernHttpClient.Android.csproj index 45a94fe..0fbeab4 100644 --- a/src/ModernHttpClient/ModernHttpClient.Android.csproj +++ b/src/ModernHttpClient/ModernHttpClient.Android.csproj @@ -1,4 +1,4 @@ - + Debug @@ -13,9 +13,9 @@ Resource Resources Assets - False + True ModernHttpClient - v2.3 + v8.0 true @@ -40,6 +40,12 @@ false + + ..\..\packages\Square.OkHttp3.3.8.1\lib\MonoAndroid\Square.OkHttp3.dll + + + ..\..\packages\Square.OkIO.1.13.0\lib\MonoAndroid\Square.OkIO.dll + @@ -47,23 +53,18 @@ + - - - - ..\..\packages\Square.OkIO.1.5.0.0\lib\MonoAndroid\Square.OkIO.dll - - - - ..\..\packages\Square.OkHttp.2.4.0.3\lib\MonoAndroid\Square.OkHttp.dll - + + + - + \ No newline at end of file diff --git a/src/ModernHttpClient/ModernHttpClient.iOS64.csproj b/src/ModernHttpClient/ModernHttpClient.iOS64.csproj index 53c41cb..097c42f 100644 --- a/src/ModernHttpClient/ModernHttpClient.iOS64.csproj +++ b/src/ModernHttpClient/ModernHttpClient.iOS64.csproj @@ -1,4 +1,4 @@ - + Debug @@ -51,8 +51,5 @@ - - - - + \ No newline at end of file diff --git a/src/ModernHttpClient/Resources/Resource.designer.cs b/src/ModernHttpClient/Resources/Resource.designer.cs index 19c6965..861eaa2 100644 --- a/src/ModernHttpClient/Resources/Resource.designer.cs +++ b/src/ModernHttpClient/Resources/Resource.designer.cs @@ -1,15 +1,15 @@ #pragma warning disable 1591 -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.17020 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ -[assembly: Android.Runtime.ResourceDesignerAttribute("ModernHttpClient.Resource", IsApplication=false)] +[assembly: global::Android.Runtime.ResourceDesignerAttribute("ModernHttpClient.Resource", IsApplication=false)] namespace ModernHttpClient { diff --git a/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs b/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs index 610999d..ed4abcd 100644 --- a/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs +++ b/src/ModernHttpClient/iOS/NSUrlSessionHandler.cs @@ -261,8 +261,6 @@ InflightOperation getResponseForTask(NSUrlSessionTask task) public override void DidReceiveChallenge(NSUrlSession session, NSUrlSessionTask task, NSUrlAuthenticationChallenge challenge, Action completionHandler) { - - if (challenge.ProtectionSpace.AuthenticationMethod == NSUrlProtectionSpace.AuthenticationMethodNTLM) { NetworkCredential credentialsToUse; @@ -303,10 +301,11 @@ public override void DidReceiveChallenge(NSUrlSession session, NSUrlSessionTask goto sslErrorVerify; } - if (serverCertChain.Count == 1) { - errors = SslPolicyErrors.RemoteCertificateChainErrors; - goto sslErrorVerify; - } + // this disables self signed certificates + //if (serverCertChain.Count == 1) { + // errors = SslPolicyErrors.RemoteCertificateChainErrors; + // goto sslErrorVerify; + //} var netCerts = Enumerable.Range(0, serverCertChain.Count) .Select(x => serverCertChain[x].ToX509Certificate2()) @@ -336,9 +335,8 @@ public override void DidReceiveChallenge(NSUrlSession session, NSUrlSessionTask goto sslErrorVerify; } - sslErrorVerify: - var hostname = task.CurrentRequest.Url.Host; - bool result = ServicePointManager.ServerCertificateValidationCallback(hostname, root, chain, errors); + sslErrorVerify: + bool result = ServicePointManager.ServerCertificateValidationCallback(getResponseForTask(task).Request, root, chain, errors); if (result) { completionHandler( NSUrlSessionAuthChallengeDisposition.UseCredential, diff --git a/src/ModernHttpClient/packages.config b/src/ModernHttpClient/packages.config index 683dfae..445ae1f 100644 --- a/src/ModernHttpClient/packages.config +++ b/src/ModernHttpClient/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/src/Playground.Android/MainActivity.cs b/src/Playground.Android/MainActivity.cs index 94a4b83..dc61e4e 100644 --- a/src/Playground.Android/MainActivity.cs +++ b/src/Playground.Android/MainActivity.cs @@ -34,7 +34,7 @@ void HandleDownloadProgress(long bytes, long totalBytes, long totalBytesExpected RunOnUiThread(() => { progress.Max = 10000; - var progressPercent = (float)totalBytes / (float)totalBytesExpected; + var progressPercent = totalBytesExpected == 0 ? 100.0f : (float)totalBytes / (float)totalBytesExpected; var progressOffset = Convert.ToInt32(progressPercent * 10000); Console.WriteLine(progressOffset); @@ -49,22 +49,16 @@ protected override void OnCreate (Bundle bundle) // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); - //This API is only available in Mono and Xamarin products. - //You can filter and/or re-order the ciphers suites that the SSL/TLS server will accept from a client. - //The following example removes weak (export) ciphers from the list that will be offered to the server. - ServicePointManager.ClientCipherSuitesCallback += (protocol, allCiphers) => - allCiphers.Where(x => !x.Contains("EXPORT")).ToList(); - //Here we accept any certificate and just print the cert's data. ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { System.Diagnostics.Debug.WriteLine("Callback Server Certificate: " + sslPolicyErrors); foreach(var el in chain.ChainElements) { System.Diagnostics.Debug.WriteLine(el.Certificate.GetCertHashString()); - System.Diagnostics.Debug.WriteLine(el.Information); + System.Diagnostics.Debug.WriteLine(el.Certificate.Subject); } - return true; + return false; }; // Get our button from the layout resource, @@ -82,10 +76,11 @@ protected override void OnCreate (Bundle bundle) Console.WriteLine("Canceled token {0:x8}", this.currentToken.Token.GetHashCode()); this.currentToken.Cancel(); if (resp != null) resp.Content.Dispose(); - }; + result.Text = string.Empty; + }; button.Click += async (o, e) => { - var handler = new NativeMessageHandler(); + var handler = new NativeMessageHandler(false, true); var client = new HttpClient(handler); currentToken = new CancellationTokenSource(); @@ -97,11 +92,14 @@ protected override void OnCreate (Bundle bundle) st.Start(); try { - //var url = "https://tv.eurosport.com"; - //var url = "https://github.com/downloads/nadlabak/android/cm-9.1.0a-umts_sholes.zip"; - var url = "https://github.com/paulcbetts/ModernHttpClient/releases/download/0.9.0/ModernHttpClient-0.9.zip"; + //var url = "https://tv.eurosport.com"; + //var url = "https://github.com/downloads/nadlabak/android/cm-9.1.0a-umts_sholes.zip"; + //var url = "https://github.com/paulcbetts/ModernHttpClient/releases/download/0.9.0/ModernHttpClient-0.9.zip"; + var url = "https://self-signed.badssl.com/"; + //var url = "https://code4ward.ddns.net:54899/status"; // switch to /status once the server has been updated - var request = new HttpRequestMessage(HttpMethod.Get, url); + + var request = new HttpRequestMessage(HttpMethod.Get, url); handler.RegisterForProgress(request, HandleDownloadProgress); resp = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, currentToken.Token); @@ -109,19 +107,22 @@ protected override void OnCreate (Bundle bundle) status.Text = string.Format("HTTP {0}: {1}", (int)resp.StatusCode, resp.ReasonPhrase); - foreach (var v in resp.Headers) { - Console.WriteLine("{0}: {1}", v.Key, String.Join(",", v.Value)); - } + var sb = new StringBuilder(); + foreach (var v in resp.Headers) + sb.AppendFormat("{0}: {1}\n", v.Key, String.Join(",", v.Value)); + sb.AppendLine(); - var stream = await resp.Content.ReadAsStreamAsync(); + var stream = await resp.Content.ReadAsStreamAsync(); var ms = new MemoryStream(); await stream.CopyToAsync(ms, 4096, currentToken.Token); var bytes = ms.ToArray(); - result.Text = String.Format("Read {0} bytes", bytes.Length); + sb.Append($"Body has {bytes.Length} bytes."); + + result.Text = sb.ToString(); - var md5 = MD5.Create(); + var md5 = MD5.Create(); var hash = md5.ComputeHash(bytes); hashView.Text = ToHex(hash, false); } catch (Exception ex) { diff --git a/src/Playground.Android/Playground.Android.csproj b/src/Playground.Android/Playground.Android.csproj index f1a135d..e748a28 100644 --- a/src/Playground.Android/Playground.Android.csproj +++ b/src/Playground.Android/Playground.Android.csproj @@ -1,4 +1,4 @@ - + Debug @@ -14,9 +14,9 @@ Resource Resources Assets - False + True Playground.Android - v4.0.3 + v8.0 Properties\AndroidManifest.xml @@ -46,17 +46,17 @@ + + ..\..\packages\Square.OkHttp3.3.8.1\lib\MonoAndroid\Square.OkHttp3.dll + + + ..\..\packages\Square.OkIO.1.13.0\lib\MonoAndroid\Square.OkIO.dll + - - ..\..\packages\Square.OkIO.1.5.0.0\lib\MonoAndroid\Square.OkIO.dll - - - ..\..\packages\Square.OkHttp.2.4.0.3\lib\MonoAndroid\Square.OkHttp.dll - @@ -64,13 +64,15 @@ + - - + + Designer + @@ -81,4 +83,4 @@ ModernHttpClient.Android - + \ No newline at end of file diff --git a/src/Playground.Android/Properties/AndroidManifest.xml b/src/Playground.Android/Properties/AndroidManifest.xml index 764fa54..3df56b0 100644 --- a/src/Playground.Android/Properties/AndroidManifest.xml +++ b/src/Playground.Android/Properties/AndroidManifest.xml @@ -1,7 +1,6 @@  - - + \ No newline at end of file diff --git a/src/Playground.Android/Resources/Resource.designer.cs b/src/Playground.Android/Resources/Resource.designer.cs index b947db6..8105f80 100644 --- a/src/Playground.Android/Resources/Resource.designer.cs +++ b/src/Playground.Android/Resources/Resource.designer.cs @@ -1,15 +1,15 @@ #pragma warning disable 1591 -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Mono Runtime Version: 4.0.30319.17020 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ -[assembly: Android.Runtime.ResourceDesignerAttribute("Playground.Android.Resource", IsApplication=true)] +[assembly: global::Android.Runtime.ResourceDesignerAttribute("Playground.Android.Resource", IsApplication=true)] namespace Playground.Android { diff --git a/src/Playground.Android/packages.config b/src/Playground.Android/packages.config index 5125da1..445ae1f 100644 --- a/src/Playground.Android/packages.config +++ b/src/Playground.Android/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/src/Playground.iOS/Playground_iOSViewController.cs b/src/Playground.iOS/Playground_iOSViewController.cs index 95d4f65..eab9934 100644 --- a/src/Playground.iOS/Playground_iOSViewController.cs +++ b/src/Playground.iOS/Playground_iOSViewController.cs @@ -31,12 +31,6 @@ public Playground_iOSViewController () : base ("Playground_iOSViewController", n }); */ - //This API is only available in Mono and Xamarin products. - //You can filter and/or re-order the ciphers suites that the SSL/TLS server will accept from a client. - //The following example removes weak (export) ciphers from the list that will be offered to the server. - ServicePointManager.ClientCipherSuitesCallback += (protocol, allCiphers) => - allCiphers.Where(x => !x.Contains("EXPORT")).ToList(); - //Here we accept any certificate and just print the cert's data. ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { System.Diagnostics.Debug.WriteLine("Callback Server Certificate: " + sslPolicyErrors);