Bug 41552

Summary: HttpResponseMessage does not support multiple Links header entries
Product: [Mono] Class Libraries Reporter: Mike Parker <michael.parker>
Component: System.Net.HttpAssignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: masafa, mono-bugs+mono
Priority: ---    
Version: 4.5.X   
Target Milestone: Untriaged   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

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?