Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NSUrlSession HttpResponseMessage.Headers.TryGetValues returns (outputs) only one element/value for multiple cookies #5148

Closed
bartlomiej-stys opened this issue Nov 20, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@bartlomiej-stys
Copy link

@bartlomiej-stys bartlomiej-stys commented Nov 20, 2018

Steps to Reproduce

  1. Choose NSUrlSession HttpClient implementation in iOS project properties
  2. Send a request with HttpClient to some site that sets mutliple different cookies
  3. Execute TryGetValues with "Set-Cookie" header name on response message: HttpResponseMessage.Headers.TryGetValues

Expected Behavior

Should return (output) more than one entry for each cookie. This behavior is default for all other implementations: Android, Windows, Linux, iOS Managed HttpClient implementation etc.

Actual Behavior

Returns (outputs) just one element that is concatenated string of multiple cookies

Environment

Microsoft Visual Studio Community 2017
Version 15.9.1
VisualStudio.15.Release/15.9.1+28307.105
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Community

Visual C++ 2017 00369-60000-00001-AA099
Microsoft Visual C++ 2017

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017 5.2.60913.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 15.9.03024.0
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.3.5001.4
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 15.9.02046.0
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.3.5001.4
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

CleanBinAndObjCommand Extension 1.0
CleanBinAndObjCommand Visual Studio Extension Detailed Info

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

File Nesting 2.6.85
Automatically nest files based on file name and enables developers to nest and unnest any file manually

GitHub.VisualStudio 2.5.9.5485
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service 2.0
JavaScript Language Service

JavaScript Project System 2.0
JavaScript Project System

JavaScript UWP Project System 2.0
JavaScript UWP Project System

Microsoft Azure HDInsight Azure Node 2.3.5001.4
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.3.5001.4
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 2.4
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.3.5001.4
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.10730.2

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 1.0
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

MLGen Package Extension 1.0
MLGen Package Visual Studio Extension Detailed Info

Mono Debugging for Visual Studio 4.13.11-pre (400cfb1)
Support for debugging Mono processes with Visual Studio.

Node.js Tools 1.4.21001.1 Commit Hash:8dd15923800d931b153ab9e4de74e42a74eba5e6
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

NVIDIA CUDA 9.2 Wizards 9.2
Wizards to create new NVIDIA CUDA projects and source files.

NVIDIA Nsight Visual Studio Edition 5.6.0.18146
NVIDIA Nsight Visual Studio Edition provides tools for GPGPU and graphics development. Copyright © NVIDIA 2010 - 2018.
•Direct3D® and DirectX® are registered trademarks of Microsoft Corporation in the United States and/or other countries.
•Microsoft Detours is used under the Professional license (http://research.microsoft.com/en-us/projects/detours/).
•Gardens Point Parser Generator Copyright 2005 Queensland University of Technology (QUT). All rights reserved.
•NLog Copyright © 2004-2006 Jaroslaw Kowalski (jaak@jkowalski.net)
•IronPython and WPFToolkit used under Microsoft Public License (Ms-PL) and are Copyright © Microsoft Corporation
•Portions of RadControls for WPF © 2010-2011 by Telerik Corporation. All rights reserved.
•zlib and libpng used under the zlib/libpnc license (http://opensource.org/licenses/Zlib)

Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.

NVIDIA Nsight Visual Studio Edition - CUDA support 5.6.0.0
NVIDIA Nsight Visual Studio Edition - CUDA support provides tools for CUDA development and debugging.

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

SlowCheetah - XML config transforms 1.0
This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.

SQL Server Data Tools 15.1.61810.11040
Microsoft SQL Server Data Tools

Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Cross Platform Mobile Development (Android) 15.0.28107.00
Visual C++ for Cross Platform Mobile Development (Android)

Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
Microsoft Visual F# Tools 10.2 for F# 4.5

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for CMake 1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Universal Windows Apps 15.0.28301.59
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin 4.12.3.69 (d15-9@15fcf6b03)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 4.16.4 (128ba449c)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 1.1.127 (e975299)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 9.1.0.38 (HEAD/61d16aa23)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK 12.2.1.10 (f2a05ed)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

https://gist.github.com/bartlomiej-stys/85b607de489528fbc6d10f9d445de5ae

Example Project (If Possible)

SetCookie.zip

@bartlomiej-stys bartlomiej-stys changed the title NSUrlSession HttpResponseMessage.Headers.TryGetValues returns only one element for multiple cookies NSUrlSession HttpResponseMessage.Headers.TryGetValues returns (outputs) only one element for multiple cookies Nov 20, 2018
@bartlomiej-stys bartlomiej-stys changed the title NSUrlSession HttpResponseMessage.Headers.TryGetValues returns (outputs) only one element for multiple cookies NSUrlSession HttpResponseMessage.Headers.TryGetValues returns (outputs) only one element/value for multiple cookies Nov 20, 2018
@dalexsoto dalexsoto added this to the Future milestone Nov 21, 2018
@dalexsoto

This comment has been minimized.

Copy link
Member

@dalexsoto dalexsoto commented Nov 21, 2018

I can confirm the described behavior above, managed handler does parse cookies correctly, our NSUrlSession handler does not.

mandel-macaque added a commit to mandel-macaque/xamarin-macios that referenced this issue Dec 8, 2018
 xamarin#5148

The response object does not have all the cookie values, instead we must
rust the cookie storage which can be used to retrieve ALL the cookies
for a task.

The header value has to be created manually because the native objects
do not expose a valid way to get the header. Tests have been added to
ensure we return the same as the managed client.

Fixes xamarin#5148
mandel-macaque added a commit that referenced this issue Dec 10, 2018
 #5148 (#5244)

The response object does not have all the cookie values, instead we must
rust the cookie storage which can be used to retrieve ALL the cookies
for a task.

The header value has to be created manually because the native objects
do not expose a valid way to get the header. Tests have been added to
ensure we return the same as the managed client.

Fixes #5148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.