From 8f2d5a593a28bdb84c16d3a85f3ca111b8ece9b5 Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 25 Dec 2017 04:38:58 +0900 Subject: [PATCH] [Modify] Add it --- websocket-sharp/Ext.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 0f1ab909..4bf90ac9 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -597,6 +597,16 @@ namespace WebSocketSharp return true; } + internal static bool KeepsAlive ( + this NameValueCollection headers, Version version + ) + { + var comparison = StringComparison.OrdinalIgnoreCase; + return version < HttpVersion.Version11 + ? headers.Contains ("Connection", "keep-alive", comparison) + : !headers.Contains ("Connection", "close", comparison); + } + internal static string Quote (this string value) { return String.Format ("\"{0}\"", value.Replace ("\"", "\\\""));