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 (show other bugs)
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)

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


Attachments

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?

Note You need to log in before you can comment on or make changes to this bug.