-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.Net.Httpbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
RFC HTTP State Management Mechanism
Grammar:
cookie-header = "Cookie:" OWS cookie-string OWS
cookie-string = cookie-pair *( ";" SP cookie-pair )
We already properly concatenated within SocketsHttpHandler when we merge request headers with cookies from the container: https://github.com/dotnet/runtime/blob/master/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/HttpConnection.cs#L247
We should do the same for all Cookie header values.
Repro:
var client = new HttpClient();
var message = new HttpRequestMessage(HttpMethod.Get, "http://localhost:5001");
// All of the Cookie header bellow will get concatenated with ','.
message.Headers.Add("Cookie", new [] {"test1=1","test2=2"});
message.Headers.Add("Cookie", "test3=3");
message.Headers.TryAddWithoutValidation("Cookie", new [] {"test4=4", "test5=5"});
message.Headers.TryAddWithoutValidation("Cookie", "test6=6");
var response = await client.SendAsync(message);Upon first look, adding a custom HttpHeaderParser overriding the separator and using it for Cookie in known header definitions: https://github.com/dotnet/runtime/blob/master/src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeaders.cs#L43 should do the trick.
Original issue: dotnet/yarp#437
hankovich, tsu1980, campersau, nullcheck and istefanou
Metadata
Metadata
Assignees
Labels
area-System.Net.Httpbughelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
