Bug 27352 - HttpRequestMessage: adding Accept header with multiple values fails
Summary: HttpRequestMessage: adding Accept header with multiple values fails
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Net.Http (show other bugs)
Version: master
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-02-24 09:29 UTC by Alexander Köplinger
Modified: 2015-02-24 10:55 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Alexander Köplinger 2015-02-24 09:29:29 UTC
Repro code:

>var request = new HttpRequestMessage();
>request.Headers.Add("Accept", "application/vnd.github.moondragon+json; charset=utf-8,application/vnd.github.v3+json; charset=utf-8");

This throws an exception on Mono 3.12 and Mono master as of today:
>System.FormatException: Invalid format.
>  at System.Net.Http.Headers.HttpHeaders.AddInternal (System.String name, IEnumerable`1 values, System.Net.Http.Headers.HeaderInfo headerInfo, Boolean ignoreInvalid) [0x0004c] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpHeaders.cs:196 
>  at System.Net.Http.Headers.HttpHeaders.Add (System.String name, IEnumerable`1 values) [0x00011] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpHeaders.cs:171 
>  at System.Net.Http.Headers.HttpHeaders.Add (System.String name, System.String value) [0x00000] in /tmp/buildd/mono-snapshot-20150224105158-20150224105158/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpHeaders.cs:163 
>  at Test.Main () [0x00000] in <filename unknown>:0 

This looks similar to https://bugzilla.xamarin.com/show_bug.cgi?id=17132 and the workaround of splitting it into multiple Add() calls works here as well.
Comment 1 Marek Safar 2015-02-24 10:55:57 UTC
Fixed in master