Skip to content

Disable/Skip CompressionHandler when NSUrlSessionHandler is used as final handler. #482

@peombwa

Description

@peombwa

Issue

NSUrlSessionHandler - Xamarin.iOS - handles decompression out of the box and doesn't provide an option to turn it off. This throws a System.IO.IOException: Corrupted data ReadInternal exception when our CompressionHandler is used alongside NSUrlSessionHandler as described in issue #413.

Workaround

The current work around involves creating a new pipeline without the CompressionHandler.

#if __IOS__
            var innerHandler = new NSUrlSessionHandler { AllowAutoRedirect = false };
            var handlers = GraphClientFactory.CreateDefaultHandlers(authProvider);
            // Remove CompressionHandler from pipeline when using NSUrlSessionHandler.
            handlers.Remove(handlers.FirstOrDefault((h) => h.GetType().Equals(typeof(CompressionHandler)))); // We need to provide a method to remove handlers by type. 
            var pipeline = GraphClientFactory.CreatePipeline(handlers , innerHandler);
            httpProvider = new HttpProvider(pipeline, true, new Serializer());

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions