From e3719401f3349c94ffba64a6d085246f1d898d72 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 5 May 2020 20:12:12 +0900 Subject: [PATCH] [Modify] Replace it --- websocket-sharp/Net/WebHeaderCollection.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index 9d32ee77..15103c30 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -995,8 +995,18 @@ namespace WebSocketSharp.Net internal void InternalSet (string header, bool response) { - var pos = checkColonSeparated (header); - InternalSet (header.Substring (0, pos), header.Substring (pos + 1), response); + var idx = header.IndexOf (':'); + + if (idx == -1) { + var msg = "It does not contain a colon character."; + + throw new ArgumentException (msg, "header"); + } + + var name = header.Substring (0, idx); + var val = header.Substring (idx + 1); + + InternalSet (name, val, response); } internal void InternalSet (string name, string value, bool response)