Skip to content

Instantly share code, notes, and snippets.

@mandel-macaque
Created October 5, 2016 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandel-macaque/ef16020ecb19208f468138bdbcea5a4b to your computer and use it in GitHub Desktop.
Save mandel-macaque/ef16020ecb19208f468138bdbcea5a4b to your computer and use it in GitHub Desktop.
diff --git a/src/Foundation/NSUrlSessionHandler.cs b/src/Foundation/NSUrlSessionHandler.cs
index a449989..5746b12 100644
--- a/src/Foundation/NSUrlSessionHandler.cs
+++ b/src/Foundation/NSUrlSessionHandler.cs
@@ -79,6 +79,7 @@ namespace Foundation {
configuration.TLSMinimumSupportedProtocol = SslProtocol.Tls_1_1;
else if ((sp & SecurityProtocolType.Tls12) != 0)
configuration.TLSMinimumSupportedProtocol = SslProtocol.Tls_1_2;
+
session = NSUrlSession.FromConfiguration (NSUrlSessionConfiguration.DefaultSessionConfiguration, new NSUrlSessionHandlerDelegate (this), null);
inflightRequests = new Dictionary<NSUrlSessionTask, InflightData> ();
@@ -139,7 +140,7 @@ namespace Foundation {
if (request.Content != null) {
stream = await request.Content.ReadAsStreamAsync ().ConfigureAwait (false);
headers = headers.Union (request.Content.Headers).ToArray ();
- }
+ }
var nsrequest = new NSMutableUrlRequest {
AllowsCellularAccess = true,
@@ -151,6 +152,9 @@ namespace Foundation {
return acc;
})
};
+
+ // disable gzip/deflate
+ nsrequest ["Accept-Encoding"] = "";
if (stream != Stream.Null)
nsrequest.BodyStream = new WrappedNSInputStream (stream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment