From 3d4c241c29be72c24d94b7c05e66ac81de456124 Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 30 Apr 2020 20:04:54 +0900 Subject: [PATCH] [Modify] Replace it --- websocket-sharp/Net/WebHeaderCollection.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index 3bb87b50..8a6159ad 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -1118,9 +1118,16 @@ namespace WebSocketSharp.Net if (header.Length == 0) throw new ArgumentException ("An empty string.", "header"); - var pos = checkColonSeparated (header); - var name = header.Substring (0, pos); - var val = header.Substring (pos + 1); + var idx = header.IndexOf (':'); + + if (idx == -1) { + var msg = "No colon could be found."; + + throw new ArgumentException (msg, "header"); + } + + var name = header.Substring (0, idx); + var val = header.Substring (idx + 1); add (name, val, false); }