From 9871c906593b096b861b26d059d1637174a994a3 Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 17 May 2020 18:12:51 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Net/WebHeaderCollection.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index bc4f6f48..2ea8f7be 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -782,6 +782,23 @@ namespace WebSocketSharp.Net base.Add (name, checkValue (value)); } + private void checkAllowed (string name) + { + if (_state == HttpHeaderType.Unspecified) + return; + + var headerType = getHeaderType (name); + + if (headerType == HttpHeaderType.Unspecified) + return; + + if (_state != headerType) { + var msg = "This collection does not allow the header."; + + throw new InvalidOperationException (msg); + } + } + private static string checkName (string name) { if (name == null)