diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index 76269de0..4bf37324 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -991,7 +991,9 @@ namespace WebSocketSharp.Net } var name = header.Substring (0, idx); - var val = header.Substring (idx + 1); + var val = idx < header.Length - 1 + ? header.Substring (idx + 1) + : String.Empty; InternalSet (name, val, response); }