[Modify] Replace it

This commit is contained in:
sta 2020-04-30 20:04:54 +09:00
parent 84082ee25a
commit 3d4c241c29

View File

@ -1118,9 +1118,16 @@ namespace WebSocketSharp.Net
if (header.Length == 0) if (header.Length == 0)
throw new ArgumentException ("An empty string.", "header"); throw new ArgumentException ("An empty string.", "header");
var pos = checkColonSeparated (header); var idx = header.IndexOf (':');
var name = header.Substring (0, pos);
var val = header.Substring (pos + 1); 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); add (name, val, false);
} }