From 48facb797ed912e4ea6b04b17d1ff190ac2daac4 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 12 Sep 2018 19:26:21 +0200 Subject: Update to 3.5.2 and .net core 2.1 --- SocketHttpListener/Ext.cs | 128 ++-------------------------------------------- 1 file changed, 3 insertions(+), 125 deletions(-) (limited to 'SocketHttpListener/Ext.cs') diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs index 87f0887ed..125775180 100644 --- a/SocketHttpListener/Ext.cs +++ b/SocketHttpListener/Ext.cs @@ -7,9 +7,8 @@ using System.Net; using System.Text; using System.Threading.Tasks; using MediaBrowser.Model.Services; -using SocketHttpListener.Net; -using HttpListenerResponse = SocketHttpListener.Net.HttpListenerResponse; using HttpStatusCode = SocketHttpListener.Net.HttpStatusCode; +using WebSocketState = System.Net.WebSockets.WebSocketState; namespace SocketHttpListener { @@ -129,7 +128,7 @@ namespace SocketHttpListener internal static string CheckIfClosable(this WebSocketState state) { - return state == WebSocketState.Closing + return state == WebSocketState.CloseSent ? "While closing the WebSocket connection." : state == WebSocketState.Closed ? "The WebSocket connection has already been closed." @@ -140,7 +139,7 @@ namespace SocketHttpListener { return state == WebSocketState.Connecting ? "A WebSocket connection isn't established." - : state == WebSocketState.Closing + : state == WebSocketState.CloseSent ? "While closing the WebSocket connection." : state == WebSocketState.Closed ? "The WebSocket connection has already been closed." @@ -154,20 +153,6 @@ namespace SocketHttpListener : null; } - internal static string CheckIfValidSendData(this byte[] data) - { - return data == null - ? "'data' must not be null." - : null; - } - - internal static string CheckIfValidSendData(this string data) - { - return data == null - ? "'data' must not be null." - : null; - } - internal static Stream Compress(this Stream stream, CompressionMethod method) { return method == CompressionMethod.Deflate @@ -631,24 +616,6 @@ namespace SocketHttpListener return false; } - /// - /// Emits the specified delegate if it isn't . - /// - /// - /// A to emit. - /// - /// - /// An from which emits this . - /// - /// - /// A that contains no event data. - /// - public static void Emit(this EventHandler eventHandler, object sender, EventArgs e) - { - if (eventHandler != null) - eventHandler(sender, e); - } - /// /// Emits the specified EventHandler<TEventArgs> delegate /// if it isn't . @@ -673,27 +640,6 @@ namespace SocketHttpListener eventHandler(sender, e); } - /// - /// Gets the collection of the HTTP cookies from the specified HTTP . - /// - /// - /// A that receives a collection of the HTTP cookies. - /// - /// - /// A that contains a collection of the HTTP headers. - /// - /// - /// true if is a collection of the response headers; - /// otherwise, false. - /// - public static CookieCollection GetCookies(this QueryParamCollection headers, bool response) - { - var name = response ? "Set-Cookie" : "Cookie"; - return headers == null || !headers.Contains(name) - ? new CookieCollection() - : CookieHelper.Parse(headers[name], response); - } - /// /// Gets the description of the specified HTTP status . /// @@ -708,52 +654,6 @@ namespace SocketHttpListener return ((int)code).GetStatusDescription(); } - /// - /// Gets the name from the specified that contains a pair of name and - /// value separated by a separator string. - /// - /// - /// A that represents the name if any; otherwise, null. - /// - /// - /// A that contains a pair of name and value separated by a separator - /// string. - /// - /// - /// A that represents a separator string. - /// - public static string GetName(this string nameAndValue, string separator) - { - return (nameAndValue != null && nameAndValue.Length > 0) && - (separator != null && separator.Length > 0) - ? nameAndValue.GetNameInternal(separator) - : null; - } - - /// - /// Gets the name and value from the specified that contains a pair of - /// name and value separated by a separator string. - /// - /// - /// A KeyValuePair<string, string> that represents the name and value if any. - /// - /// - /// A that contains a pair of name and value separated by a separator - /// string. - /// - /// - /// A that represents a separator string. - /// - public static KeyValuePair GetNameAndValue( - this string nameAndValue, string separator) - { - var name = nameAndValue.GetName(separator); - var value = nameAndValue.GetValue(separator); - return name != null - ? new KeyValuePair(name, value) - : new KeyValuePair(null, null); - } - /// /// Gets the description of the specified HTTP status . /// @@ -818,28 +718,6 @@ namespace SocketHttpListener return String.Empty; } - /// - /// Gets the value from the specified that contains a pair of name and - /// value separated by a separator string. - /// - /// - /// A that represents the value if any; otherwise, null. - /// - /// - /// A that contains a pair of name and value separated by a separator - /// string. - /// - /// - /// A that represents a separator string. - /// - public static string GetValue(this string nameAndValue, string separator) - { - return (nameAndValue != null && nameAndValue.Length > 0) && - (separator != null && separator.Length > 0) - ? nameAndValue.GetValueInternal(separator) - : null; - } - /// /// Determines whether the specified is host /// (this computer architecture) byte order. -- cgit v1.2.3