Web Sockets: work around .NET FX bug (#702)

This commit is contained in:
David Nissimoff 2018-12-17 11:39:06 -08:00 committed by Tom Pallister
parent 14cff23d48
commit fa5892d236

View File

@ -90,7 +90,16 @@ namespace Ocelot.WebSockets.Middleware
{ {
if (!NotForwardedWebSocketHeaders.Contains(headerEntry.Key, StringComparer.OrdinalIgnoreCase)) if (!NotForwardedWebSocketHeaders.Contains(headerEntry.Key, StringComparer.OrdinalIgnoreCase))
{ {
client.Options.SetRequestHeader(headerEntry.Key, headerEntry.Value); try
{
client.Options.SetRequestHeader(headerEntry.Key, headerEntry.Value);
}
catch (ArgumentException)
{
// Expected in .NET Framework for headers that are mistakenly considered restricted.
// See: https://github.com/dotnet/corefx/issues/26627
// .NET Core does not exhibit this issue, ironically due to a separate bug (https://github.com/dotnet/corefx/issues/18784)
}
} }
} }