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

@ -89,9 +89,18 @@ namespace Ocelot.WebSockets.Middleware
foreach (var headerEntry in context.Request.Headers)
{
if (!NotForwardedWebSocketHeaders.Contains(headerEntry.Key, StringComparer.OrdinalIgnoreCase))
{
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)
}
}
}
var destinationUri = new Uri(serverEndpoint);