Bug 41552 - HttpResponseMessage does not support multiple Links header entries
Summary: HttpResponseMessage does not support multiple Links header entries
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Net.Http ()
Version: 4.5.X
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-06-07 11:59 UTC by Mike Parker
Modified: 2016-06-20 13:45 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 Mike Parker 2016-06-07 11:59:20 UTC
HttpResponseMessage doesn't support multiple entries for the Link header. We use several APIs that specify multiple Link fields which works on .NET but does not work with the Mono implementation.

What seems to happen is the final Link is kept as a single header and overwrites all previous entries.

e.g.

Link:<https://testapi:9000/971fb498-403a-41df-8ad1-7466e04fc18a/quotes>;rel="http://schemas.us.com/api"
Link:</schemas/api.jsonld>;rel="describedBy"
Link:<https://diagnostics-api.us.com/history/971fb498-403a-41df-8ad1-7466e04fc18a>;rel="http://schemas.us.com/api/history"
Link:<https://api-test.us.com/recons/971fb498-403a-41df-8ad1-7466e04fc18a>;rel="self"

Comes through as 

Link:<https://api-test.us.com/recons/971fb498-403a-41df-8ad1-7466e04fc18a>;rel="self"

From a cursory look at the implementation, perhaps the collection here https://github.com/mono/mono/blob/master/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpHeaders.cs

Should include Links as a multi collection, or more generally perhaps any other header field not currently added as a collection should support this by default?
Comment 1 Mike Parker 2016-06-07 14:23:37 UTC
After some further investigation, it looks like the problem is around WebRequest in System.Net, rather than inside HttpHeaders.

This means we see the same behaviour using Microsofts System.Net.Http library whilst it's still using Mono System.Net.
Comment 2 Marek Safar 2016-06-10 11:07:05 UTC
Fixed in master and Mono 4.5.1
Comment 3 Mike Parker 2016-06-10 11:11:36 UTC
Nice - thanks for speedy resolution.
Comment 4 Mike Parker 2016-06-20 13:45:51 UTC
Do you know when this is due for release?