1iveowl / WebsocketClientLite.PCL

Websocket client lite
MIT License
39 stars 14 forks source link

Sec-WebSocket-Protocol is aggregated wrong #44

Closed dietert closed 6 years ago

dietert commented 6 years ago

Hello,

Sec-WebSocket-Protocol is aggregated wrong

See: https://github.com/1iveowl/WebsocketClientLite.PCL/blob/119be3d3e118751b06c22d6157526e6d93253677/src/main/WebsocketClientLite.Netstandard/Helper/ClientHandShake.cs#L43

E.g: following line

List subprotocols = new List {"soap", "json"};

Will insert into the headers (wrong)

Sec-WebSocket-Protocol: , soap, json

Instead of (correct)

Sec-WebSocket-Protocol: soap, json

Possible solution:

var subprotocol = $"Sec-WebSocket-Protocol: {subprotocols.Aggregate((current, protocol) => $"{current}, {protocol}")}";

1iveowl commented 6 years ago

Good catch. It's been fixed. in version 4.14.