diff --git a/SocketHttpListener/ByteOrder.cs b/SocketHttpListener/ByteOrder.cs
index f5db52fd72..c04150c74b 100644
--- a/SocketHttpListener/ByteOrder.cs
+++ b/SocketHttpListener/ByteOrder.cs
@@ -1,17 +1,17 @@
namespace SocketHttpListener
{
- ///
- /// Contains the values that indicate whether the byte order is a Little-endian or Big-endian.
- ///
- public enum ByteOrder : byte
- {
///
- /// Indicates a Little-endian.
+ /// Contains the values that indicate whether the byte order is a Little-endian or Big-endian.
///
- Little,
- ///
- /// Indicates a Big-endian.
- ///
- Big
- }
+ public enum ByteOrder : byte
+ {
+ ///
+ /// Indicates a Little-endian.
+ ///
+ Little,
+ ///
+ /// Indicates a Big-endian.
+ ///
+ Big
+ }
}
diff --git a/SocketHttpListener/CloseEventArgs.cs b/SocketHttpListener/CloseEventArgs.cs
index ff30126bc4..12a24bb4a4 100644
--- a/SocketHttpListener/CloseEventArgs.cs
+++ b/SocketHttpListener/CloseEventArgs.cs
@@ -3,88 +3,95 @@ using System.Text;
namespace SocketHttpListener
{
- ///
- /// Contains the event data associated with a event.
- ///
- ///
- /// A event occurs when the WebSocket connection has been closed.
- /// If you would like to get the reason for the close, you should access the or
- /// property.
- ///
- public class CloseEventArgs : EventArgs
- {
- #region Private Fields
-
- private bool _clean;
- private ushort _code;
- private string _reason;
-
- #endregion
-
- #region Internal Constructors
-
- internal CloseEventArgs (PayloadData payload)
+ ///
+ /// Contains the event data associated with a event.
+ ///
+ ///
+ /// A event occurs when the WebSocket connection has been closed.
+ /// If you would like to get the reason for the close, you should access the or
+ /// property.
+ ///
+ public class CloseEventArgs : EventArgs
{
- var data = payload.ApplicationData;
- var len = data.Length;
- _code = len > 1
- ? data.SubArray (0, 2).ToUInt16 (ByteOrder.Big)
- : (ushort) CloseStatusCode.NoStatusCode;
+ #region Private Fields
- _reason = len > 2
- ? GetUtf8String(data.SubArray (2, len - 2))
- : string.Empty;
+ private bool _clean;
+ private ushort _code;
+ private string _reason;
+
+ #endregion
+
+ #region Internal Constructors
+
+ internal CloseEventArgs(PayloadData payload)
+ {
+ var data = payload.ApplicationData;
+ var len = data.Length;
+ _code = len > 1
+ ? data.SubArray(0, 2).ToUInt16(ByteOrder.Big)
+ : (ushort)CloseStatusCode.NoStatusCode;
+
+ _reason = len > 2
+ ? GetUtf8String(data.SubArray(2, len - 2))
+ : string.Empty;
+ }
+
+ private static string GetUtf8String(byte[] bytes)
+ {
+ return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ ///
+ /// Gets the status code for the close.
+ ///
+ ///
+ /// A that represents the status code for the close if any.
+ ///
+ public ushort Code
+ {
+ get
+ {
+ return _code;
+ }
+ }
+
+ ///
+ /// Gets the reason for the close.
+ ///
+ ///
+ /// A that represents the reason for the close if any.
+ ///
+ public string Reason
+ {
+ get
+ {
+ return _reason;
+ }
+ }
+
+ ///
+ /// Gets a value indicating whether the WebSocket connection has been closed cleanly.
+ ///
+ ///
+ /// true if the WebSocket connection has been closed cleanly; otherwise, false.
+ ///
+ public bool WasClean
+ {
+ get
+ {
+ return _clean;
+ }
+
+ internal set
+ {
+ _clean = value;
+ }
+ }
+
+ #endregion
}
-
- private static string GetUtf8String(byte[] bytes)
- {
- return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
- }
-
- #endregion
-
- #region Public Properties
-
- ///
- /// Gets the status code for the close.
- ///
- ///
- /// A that represents the status code for the close if any.
- ///
- public ushort Code {
- get {
- return _code;
- }
- }
-
- ///
- /// Gets the reason for the close.
- ///
- ///
- /// A that represents the reason for the close if any.
- ///
- public string Reason {
- get {
- return _reason;
- }
- }
-
- ///
- /// Gets a value indicating whether the WebSocket connection has been closed cleanly.
- ///
- ///
- /// true if the WebSocket connection has been closed cleanly; otherwise, false.
- ///
- public bool WasClean {
- get {
- return _clean;
- }
-
- internal set {
- _clean = value;
- }
- }
-
- #endregion
- }
}
diff --git a/SocketHttpListener/CloseStatusCode.cs b/SocketHttpListener/CloseStatusCode.cs
index 62a268bce1..428595bb09 100644
--- a/SocketHttpListener/CloseStatusCode.cs
+++ b/SocketHttpListener/CloseStatusCode.cs
@@ -1,94 +1,94 @@
namespace SocketHttpListener
{
- ///
- /// Contains the values of the status code for the WebSocket connection close.
- ///
- ///
- ///
- /// The values of the status code are defined in
- /// Section 7.4
- /// of RFC 6455.
- ///
- ///
- /// "Reserved value" must not be set as a status code in a close control frame
- /// by an endpoint. It's designated for use in applications expecting a status
- /// code to indicate that the connection was closed due to the system grounds.
- ///
- ///
- public enum CloseStatusCode : ushort
- {
///
- /// Equivalent to close status 1000.
- /// Indicates a normal close.
+ /// Contains the values of the status code for the WebSocket connection close.
///
- Normal = 1000,
- ///
- /// Equivalent to close status 1001.
- /// Indicates that an endpoint is going away.
- ///
- Away = 1001,
- ///
- /// Equivalent to close status 1002.
- /// Indicates that an endpoint is terminating the connection due to a protocol error.
- ///
- ProtocolError = 1002,
- ///
- /// Equivalent to close status 1003.
- /// Indicates that an endpoint is terminating the connection because it has received
- /// an unacceptable type message.
- ///
- IncorrectData = 1003,
- ///
- /// Equivalent to close status 1004.
- /// Still undefined. Reserved value.
- ///
- Undefined = 1004,
- ///
- /// Equivalent to close status 1005.
- /// Indicates that no status code was actually present. Reserved value.
- ///
- NoStatusCode = 1005,
- ///
- /// Equivalent to close status 1006.
- /// Indicates that the connection was closed abnormally. Reserved value.
- ///
- Abnormal = 1006,
- ///
- /// Equivalent to close status 1007.
- /// Indicates that an endpoint is terminating the connection because it has received
- /// a message that contains a data that isn't consistent with the type of the message.
- ///
- InconsistentData = 1007,
- ///
- /// Equivalent to close status 1008.
- /// Indicates that an endpoint is terminating the connection because it has received
- /// a message that violates its policy.
- ///
- PolicyViolation = 1008,
- ///
- /// Equivalent to close status 1009.
- /// Indicates that an endpoint is terminating the connection because it has received
- /// a message that is too big to process.
- ///
- TooBig = 1009,
- ///
- /// Equivalent to close status 1010.
- /// Indicates that the client is terminating the connection because it has expected
- /// the server to negotiate one or more extension, but the server didn't return them
- /// in the handshake response.
- ///
- IgnoreExtension = 1010,
- ///
- /// Equivalent to close status 1011.
- /// Indicates that the server is terminating the connection because it has encountered
- /// an unexpected condition that prevented it from fulfilling the request.
- ///
- ServerError = 1011,
- ///
- /// Equivalent to close status 1015.
- /// Indicates that the connection was closed due to a failure to perform a TLS handshake.
- /// Reserved value.
- ///
- TlsHandshakeFailure = 1015
- }
+ ///
+ ///
+ /// The values of the status code are defined in
+ /// Section 7.4
+ /// of RFC 6455.
+ ///
+ ///
+ /// "Reserved value" must not be set as a status code in a close control frame
+ /// by an endpoint. It's designated for use in applications expecting a status
+ /// code to indicate that the connection was closed due to the system grounds.
+ ///
+ ///
+ public enum CloseStatusCode : ushort
+ {
+ ///
+ /// Equivalent to close status 1000.
+ /// Indicates a normal close.
+ ///
+ Normal = 1000,
+ ///
+ /// Equivalent to close status 1001.
+ /// Indicates that an endpoint is going away.
+ ///
+ Away = 1001,
+ ///
+ /// Equivalent to close status 1002.
+ /// Indicates that an endpoint is terminating the connection due to a protocol error.
+ ///
+ ProtocolError = 1002,
+ ///
+ /// Equivalent to close status 1003.
+ /// Indicates that an endpoint is terminating the connection because it has received
+ /// an unacceptable type message.
+ ///
+ IncorrectData = 1003,
+ ///
+ /// Equivalent to close status 1004.
+ /// Still undefined. Reserved value.
+ ///
+ Undefined = 1004,
+ ///
+ /// Equivalent to close status 1005.
+ /// Indicates that no status code was actually present. Reserved value.
+ ///
+ NoStatusCode = 1005,
+ ///
+ /// Equivalent to close status 1006.
+ /// Indicates that the connection was closed abnormally. Reserved value.
+ ///
+ Abnormal = 1006,
+ ///
+ /// Equivalent to close status 1007.
+ /// Indicates that an endpoint is terminating the connection because it has received
+ /// a message that contains a data that isn't consistent with the type of the message.
+ ///
+ InconsistentData = 1007,
+ ///
+ /// Equivalent to close status 1008.
+ /// Indicates that an endpoint is terminating the connection because it has received
+ /// a message that violates its policy.
+ ///
+ PolicyViolation = 1008,
+ ///
+ /// Equivalent to close status 1009.
+ /// Indicates that an endpoint is terminating the connection because it has received
+ /// a message that is too big to process.
+ ///
+ TooBig = 1009,
+ ///
+ /// Equivalent to close status 1010.
+ /// Indicates that the client is terminating the connection because it has expected
+ /// the server to negotiate one or more extension, but the server didn't return them
+ /// in the handshake response.
+ ///
+ IgnoreExtension = 1010,
+ ///
+ /// Equivalent to close status 1011.
+ /// Indicates that the server is terminating the connection because it has encountered
+ /// an unexpected condition that prevented it from fulfilling the request.
+ ///
+ ServerError = 1011,
+ ///
+ /// Equivalent to close status 1015.
+ /// Indicates that the connection was closed due to a failure to perform a TLS handshake.
+ /// Reserved value.
+ ///
+ TlsHandshakeFailure = 1015
+ }
}
diff --git a/SocketHttpListener/CompressionMethod.cs b/SocketHttpListener/CompressionMethod.cs
index 36a48d94cb..d6bcd63d89 100644
--- a/SocketHttpListener/CompressionMethod.cs
+++ b/SocketHttpListener/CompressionMethod.cs
@@ -1,23 +1,23 @@
namespace SocketHttpListener
{
- ///
- /// Contains the values of the compression method used to compress the message on the WebSocket
- /// connection.
- ///
- ///
- /// The values of the compression method are defined in
- /// Compression
- /// Extensions for WebSocket.
- ///
- public enum CompressionMethod : byte
- {
///
- /// Indicates non compression.
+ /// Contains the values of the compression method used to compress the message on the WebSocket
+ /// connection.
///
- None,
- ///
- /// Indicates using DEFLATE.
- ///
- Deflate
- }
+ ///
+ /// The values of the compression method are defined in
+ /// Compression
+ /// Extensions for WebSocket.
+ ///
+ public enum CompressionMethod : byte
+ {
+ ///
+ /// Indicates non compression.
+ ///
+ None,
+ ///
+ /// Indicates using DEFLATE.
+ ///
+ Deflate
+ }
}
diff --git a/SocketHttpListener/ErrorEventArgs.cs b/SocketHttpListener/ErrorEventArgs.cs
index bf1d6fc95f..6a85feb9cc 100644
--- a/SocketHttpListener/ErrorEventArgs.cs
+++ b/SocketHttpListener/ErrorEventArgs.cs
@@ -2,45 +2,47 @@ using System;
namespace SocketHttpListener
{
- ///
- /// Contains the event data associated with a event.
- ///
- ///
- /// A event occurs when the gets an error.
- /// If you would like to get the error message, you should access the
- /// property.
- ///
- public class ErrorEventArgs : EventArgs
- {
- #region Private Fields
-
- private string _message;
-
- #endregion
-
- #region Internal Constructors
-
- internal ErrorEventArgs (string message)
- {
- _message = message;
- }
-
- #endregion
-
- #region Public Properties
-
///
- /// Gets the error message.
+ /// Contains the event data associated with a event.
///
- ///
- /// A that represents the error message.
- ///
- public string Message {
- get {
- return _message;
- }
- }
+ ///
+ /// A event occurs when the gets an error.
+ /// If you would like to get the error message, you should access the
+ /// property.
+ ///
+ public class ErrorEventArgs : EventArgs
+ {
+ #region Private Fields
- #endregion
- }
+ private string _message;
+
+ #endregion
+
+ #region Internal Constructors
+
+ internal ErrorEventArgs(string message)
+ {
+ _message = message;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ ///
+ /// Gets the error message.
+ ///
+ ///
+ /// A that represents the error message.
+ ///
+ public string Message
+ {
+ get
+ {
+ return _message;
+ }
+ }
+
+ #endregion
+ }
}
diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs
index 4404235ba6..4a92f1c7da 100644
--- a/SocketHttpListener/Ext.cs
+++ b/SocketHttpListener/Ext.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Net;
@@ -441,7 +440,8 @@ namespace SocketHttpListener
continue;
}
}
- else {
+ else
+ {
}
buffer.Append(c);
diff --git a/SocketHttpListener/Fin.cs b/SocketHttpListener/Fin.cs
index f91401b995..c8ffbf2b2f 100644
--- a/SocketHttpListener/Fin.cs
+++ b/SocketHttpListener/Fin.cs
@@ -1,8 +1,8 @@
namespace SocketHttpListener
{
- internal enum Fin : byte
- {
- More = 0x0,
- Final = 0x1
- }
+ internal enum Fin : byte
+ {
+ More = 0x0,
+ Final = 0x1
+ }
}
diff --git a/SocketHttpListener/HttpBase.cs b/SocketHttpListener/HttpBase.cs
index d4ae857ff4..4dffe3223d 100644
--- a/SocketHttpListener/HttpBase.cs
+++ b/SocketHttpListener/HttpBase.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.IO;
using System.Text;
-using System.Threading;
using MediaBrowser.Model.Services;
namespace SocketHttpListener
diff --git a/SocketHttpListener/HttpResponse.cs b/SocketHttpListener/HttpResponse.cs
index 535fde0310..24befccb34 100644
--- a/SocketHttpListener/HttpResponse.cs
+++ b/SocketHttpListener/HttpResponse.cs
@@ -1,13 +1,11 @@
using System;
-using System.Collections.Specialized;
-using System.IO;
+using System.Linq;
using System.Net;
using System.Text;
-using HttpStatusCode = SocketHttpListener.Net.HttpStatusCode;
-using HttpVersion = SocketHttpListener.Net.HttpVersion;
-using System.Linq;
using MediaBrowser.Model.Services;
using SocketHttpListener.Net;
+using HttpStatusCode = SocketHttpListener.Net.HttpStatusCode;
+using HttpVersion = SocketHttpListener.Net.HttpVersion;
namespace SocketHttpListener
{
diff --git a/SocketHttpListener/Mask.cs b/SocketHttpListener/Mask.cs
index adc2f098e9..c56f5b08c0 100644
--- a/SocketHttpListener/Mask.cs
+++ b/SocketHttpListener/Mask.cs
@@ -1,8 +1,8 @@
namespace SocketHttpListener
{
- internal enum Mask : byte
- {
- Unmask = 0x0,
- Mask = 0x1
- }
+ internal enum Mask : byte
+ {
+ Unmask = 0x0,
+ Mask = 0x1
+ }
}
diff --git a/SocketHttpListener/MessageEventArgs.cs b/SocketHttpListener/MessageEventArgs.cs
index 86614c43c7..5ee4099b86 100644
--- a/SocketHttpListener/MessageEventArgs.cs
+++ b/SocketHttpListener/MessageEventArgs.cs
@@ -3,94 +3,100 @@ using System.Text;
namespace SocketHttpListener
{
- ///
- /// Contains the event data associated with a event.
- ///
- ///
- /// A event occurs when the receives
- /// a text or binary data frame.
- /// If you want to get the received data, you access the or
- /// property.
- ///
- public class MessageEventArgs : EventArgs
- {
- #region Private Fields
-
- private string _data;
- private Opcode _opcode;
- private byte[] _rawData;
-
- #endregion
-
- #region Internal Constructors
-
- internal MessageEventArgs (Opcode opcode, byte[] data)
- {
- _opcode = opcode;
- _rawData = data;
- _data = convertToString (opcode, data);
- }
-
- internal MessageEventArgs (Opcode opcode, PayloadData payload)
- {
- _opcode = opcode;
- _rawData = payload.ApplicationData;
- _data = convertToString (opcode, _rawData);
- }
-
- #endregion
-
- #region Public Properties
-
///
- /// Gets the received data as a .
+ /// Contains the event data associated with a event.
///
- ///
- /// A that contains the received data.
- ///
- public string Data {
- get {
- return _data;
- }
- }
-
- ///
- /// Gets the received data as an array of .
- ///
- ///
- /// An array of that contains the received data.
- ///
- public byte [] RawData {
- get {
- return _rawData;
- }
- }
-
- ///
- /// Gets the type of the received data.
- ///
- ///
- /// One of the values, indicates the type of the received data.
- ///
- public Opcode Type {
- get {
- return _opcode;
- }
- }
-
- #endregion
-
- #region Private Methods
-
- private static string convertToString (Opcode opcode, byte [] data)
+ ///
+ /// A event occurs when the receives
+ /// a text or binary data frame.
+ /// If you want to get the received data, you access the or
+ /// property.
+ ///
+ public class MessageEventArgs : EventArgs
{
- return data.Length == 0
- ? string.Empty
- : opcode == Opcode.Text
- ? Encoding.UTF8.GetString (data, 0, data.Length)
- : opcode.ToString ();
- }
+ #region Private Fields
- #endregion
- }
+ private string _data;
+ private Opcode _opcode;
+ private byte[] _rawData;
+
+ #endregion
+
+ #region Internal Constructors
+
+ internal MessageEventArgs(Opcode opcode, byte[] data)
+ {
+ _opcode = opcode;
+ _rawData = data;
+ _data = convertToString(opcode, data);
+ }
+
+ internal MessageEventArgs(Opcode opcode, PayloadData payload)
+ {
+ _opcode = opcode;
+ _rawData = payload.ApplicationData;
+ _data = convertToString(opcode, _rawData);
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ ///
+ /// Gets the received data as a .
+ ///
+ ///
+ /// A that contains the received data.
+ ///
+ public string Data
+ {
+ get
+ {
+ return _data;
+ }
+ }
+
+ ///
+ /// Gets the received data as an array of .
+ ///
+ ///
+ /// An array of that contains the received data.
+ ///
+ public byte[] RawData
+ {
+ get
+ {
+ return _rawData;
+ }
+ }
+
+ ///
+ /// Gets the type of the received data.
+ ///
+ ///
+ /// One of the values, indicates the type of the received data.
+ ///
+ public Opcode Type
+ {
+ get
+ {
+ return _opcode;
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private static string convertToString(Opcode opcode, byte[] data)
+ {
+ return data.Length == 0
+ ? string.Empty
+ : opcode == Opcode.Text
+ ? Encoding.UTF8.GetString(data, 0, data.Length)
+ : opcode.ToString();
+ }
+
+ #endregion
+ }
}
diff --git a/SocketHttpListener/Net/AuthenticationTypes.cs b/SocketHttpListener/Net/AuthenticationTypes.cs
index df6b9d576d..991133c296 100644
--- a/SocketHttpListener/Net/AuthenticationTypes.cs
+++ b/SocketHttpListener/Net/AuthenticationTypes.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace SocketHttpListener.Net
+namespace SocketHttpListener.Net
{
internal class AuthenticationTypes
{
diff --git a/SocketHttpListener/Net/BoundaryType.cs b/SocketHttpListener/Net/BoundaryType.cs
index f1e799f63c..8c940c25d3 100644
--- a/SocketHttpListener/Net/BoundaryType.cs
+++ b/SocketHttpListener/Net/BoundaryType.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SocketHttpListener.Net
+namespace SocketHttpListener.Net
{
internal enum BoundaryType
{
diff --git a/SocketHttpListener/Net/ChunkStream.cs b/SocketHttpListener/Net/ChunkStream.cs
index 5cc01614fa..b9b5edb381 100644
--- a/SocketHttpListener/Net/ChunkStream.cs
+++ b/SocketHttpListener/Net/ChunkStream.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
diff --git a/SocketHttpListener/Net/ChunkedInputStream.cs b/SocketHttpListener/Net/ChunkedInputStream.cs
index 4d6d96a6cb..e24218456c 100644
--- a/SocketHttpListener/Net/ChunkedInputStream.cs
+++ b/SocketHttpListener/Net/ChunkedInputStream.cs
@@ -1,8 +1,6 @@
using System;
using System.IO;
using System.Net;
-using System.Runtime.InteropServices;
-using SocketHttpListener.Primitives;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/CookieHelper.cs b/SocketHttpListener/Net/CookieHelper.cs
index 6c1764e09e..32b46fb69b 100644
--- a/SocketHttpListener/Net/CookieHelper.cs
+++ b/SocketHttpListener/Net/CookieHelper.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Text;
-using System.Threading.Tasks;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/EntitySendFormat.cs b/SocketHttpListener/Net/EntitySendFormat.cs
index 9caee3e112..cb3aa424c4 100644
--- a/SocketHttpListener/Net/EntitySendFormat.cs
+++ b/SocketHttpListener/Net/EntitySendFormat.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SocketHttpListener.Net
+namespace SocketHttpListener.Net
{
internal enum EntitySendFormat
{
diff --git a/SocketHttpListener/Net/HttpConnection.cs b/SocketHttpListener/Net/HttpConnection.cs
index 4fc9a468c7..86f9dc6357 100644
--- a/SocketHttpListener/Net/HttpConnection.cs
+++ b/SocketHttpListener/Net/HttpConnection.cs
@@ -3,19 +3,17 @@ using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
+using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
-using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Text;
+using Microsoft.Extensions.Logging;
using SocketHttpListener.Primitives;
-using System.Security.Authentication;
-
-using System.Threading;
namespace SocketHttpListener.Net
{
sealed class HttpConnection
diff --git a/SocketHttpListener/Net/HttpEndPointListener.cs b/SocketHttpListener/Net/HttpEndPointListener.cs
index a108e7dd46..ee6ddaa84a 100644
--- a/SocketHttpListener/Net/HttpEndPointListener.cs
+++ b/SocketHttpListener/Net/HttpEndPointListener.cs
@@ -1,21 +1,15 @@
using System;
-using System.Collections;
using System.Collections.Generic;
-using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Text;
-using SocketHttpListener.Primitives;
-using ProtocolType = MediaBrowser.Model.Net.ProtocolType;
-using SocketType = MediaBrowser.Model.Net.SocketType;
-using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
namespace SocketHttpListener.Net
{
@@ -209,7 +203,7 @@ namespace SocketHttpListener.Net
return;
}
- if(accepted == null)
+ if (accepted == null)
{
return;
}
diff --git a/SocketHttpListener/Net/HttpEndPointManager.cs b/SocketHttpListener/Net/HttpEndPointManager.cs
index 01b5ae9bd9..787730ed41 100644
--- a/SocketHttpListener/Net/HttpEndPointManager.cs
+++ b/SocketHttpListener/Net/HttpEndPointManager.cs
@@ -3,12 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
-using System.Reflection;
-using System.Threading.Tasks;
-using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
-using MediaBrowser.Model.Net;
-using SocketHttpListener.Primitives;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpKnownHeaderNames.cs b/SocketHttpListener/Net/HttpKnownHeaderNames.cs
index ea46958501..bef25ab163 100644
--- a/SocketHttpListener/Net/HttpKnownHeaderNames.cs
+++ b/SocketHttpListener/Net/HttpKnownHeaderNames.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace SocketHttpListener.Net
+namespace SocketHttpListener.Net
{
internal static partial class HttpKnownHeaderNames
{
diff --git a/SocketHttpListener/Net/HttpListener.cs b/SocketHttpListener/Net/HttpListener.cs
index a159cd273a..4e2239a1a0 100644
--- a/SocketHttpListener/Net/HttpListener.cs
+++ b/SocketHttpListener/Net/HttpListener.cs
@@ -1,17 +1,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.IO;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Text;
-using SocketHttpListener.Primitives;
+using Microsoft.Extensions.Logging;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpListenerContext.Managed.cs b/SocketHttpListener/Net/HttpListenerContext.Managed.cs
index db795f7425..a017d0d27f 100644
--- a/SocketHttpListener/Net/HttpListenerContext.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerContext.Managed.cs
@@ -1,8 +1,8 @@
-using System.ComponentModel;
+using System;
+using System.ComponentModel;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
-using System;
using MediaBrowser.Model.Text;
using SocketHttpListener.Net.WebSockets;
diff --git a/SocketHttpListener/Net/HttpListenerContext.cs b/SocketHttpListener/Net/HttpListenerContext.cs
index e3e6eb906e..0bb31ef3e4 100644
--- a/SocketHttpListener/Net/HttpListenerContext.cs
+++ b/SocketHttpListener/Net/HttpListenerContext.cs
@@ -1,12 +1,8 @@
using System;
using System.Net;
using System.Security.Principal;
-using MediaBrowser.Model.Cryptography;
-using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
-using MediaBrowser.Model.Text;
-using SocketHttpListener.Net.WebSockets;
using System.Threading.Tasks;
+using SocketHttpListener.Net.WebSockets;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpListenerRequest.Managed.cs b/SocketHttpListener/Net/HttpListenerRequest.Managed.cs
index 8b68afe33c..54bfa36a0d 100644
--- a/SocketHttpListener/Net/HttpListenerRequest.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerRequest.Managed.cs
@@ -1,12 +1,7 @@
using System;
-using System.Text;
-using System.Collections.Specialized;
-using System.Globalization;
using System.IO;
-using System.Security.Authentication.ExtendedProtection;
-using System.Security.Cryptography.X509Certificates;
+using System.Text;
using MediaBrowser.Model.Services;
-using MediaBrowser.Model.Text;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpListenerRequest.cs b/SocketHttpListener/Net/HttpListenerRequest.cs
index 16e2456112..2e8396f6f3 100644
--- a/SocketHttpListener/Net/HttpListenerRequest.cs
+++ b/SocketHttpListener/Net/HttpListenerRequest.cs
@@ -1,17 +1,11 @@
using System;
-using System.Collections.Specialized;
-using System.Globalization;
-using System.IO;
-using System.Net;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using System.Threading.Tasks;
-using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Services;
-using MediaBrowser.Model.Text;
-using SocketHttpListener.Primitives;
using System.Collections.Generic;
+using System.Globalization;
+using System.Net;
+using System.Text;
+using MediaBrowser.Model.Services;
using SocketHttpListener.Net.WebSockets;
+using SocketHttpListener.Primitives;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs
index 63790d7962..ced23d9c2d 100644
--- a/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs
+++ b/SocketHttpListener/Net/HttpListenerRequestUriBuilder.cs
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Text;
using System.Globalization;
+using System.Text;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
index 8fb4518a15..ff4437d9e8 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
@@ -1,14 +1,13 @@
using System;
-using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Model.IO;
using MediaBrowser.Model.Text;
using SocketHttpListener.Primitives;
-using System.Threading;
-using MediaBrowser.Model.IO;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpListenerResponse.cs b/SocketHttpListener/Net/HttpListenerResponse.cs
index 351a206eec..f9455db727 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.cs
@@ -1,14 +1,7 @@
using System;
-using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
-using System.Threading.Tasks;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.ComponentModel;
-using System.Diagnostics;
-using Microsoft.Win32.SafeHandles;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpRequestStream.Managed.cs b/SocketHttpListener/Net/HttpRequestStream.Managed.cs
index 493e2673b2..a0b6cba7e7 100644
--- a/SocketHttpListener/Net/HttpRequestStream.Managed.cs
+++ b/SocketHttpListener/Net/HttpRequestStream.Managed.cs
@@ -1,9 +1,5 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Runtime.ExceptionServices;
-using System.Text;
-using System.Threading.Tasks;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpRequestStream.cs b/SocketHttpListener/Net/HttpRequestStream.cs
index c9a1d5a2db..d5cbc86d84 100644
--- a/SocketHttpListener/Net/HttpRequestStream.cs
+++ b/SocketHttpListener/Net/HttpRequestStream.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
diff --git a/SocketHttpListener/Net/HttpResponseStream.Managed.cs b/SocketHttpListener/Net/HttpResponseStream.Managed.cs
index 719dfcc129..5fcf08d023 100644
--- a/SocketHttpListener/Net/HttpResponseStream.Managed.cs
+++ b/SocketHttpListener/Net/HttpResponseStream.Managed.cs
@@ -1,15 +1,13 @@
using System;
-using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
-using System.Runtime.ExceptionServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
-using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
+using Microsoft.Extensions.Logging;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/HttpResponseStream.cs b/SocketHttpListener/Net/HttpResponseStream.cs
index 5b7fa417f3..8ae7f2881a 100644
--- a/SocketHttpListener/Net/HttpResponseStream.cs
+++ b/SocketHttpListener/Net/HttpResponseStream.cs
@@ -1,7 +1,5 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
diff --git a/SocketHttpListener/Net/HttpStatusCode.cs b/SocketHttpListener/Net/HttpStatusCode.cs
index 93da82ba08..d4bb61b8a7 100644
--- a/SocketHttpListener/Net/HttpStatusCode.cs
+++ b/SocketHttpListener/Net/HttpStatusCode.cs
@@ -1,321 +1,321 @@
namespace SocketHttpListener.Net
{
- ///
- /// Contains the values of the HTTP status codes.
- ///
- ///
- /// The HttpStatusCode enumeration contains the values of the HTTP status codes defined in
- /// RFC 2616 for HTTP 1.1.
- ///
- public enum HttpStatusCode
- {
///
- /// Equivalent to status code 100.
- /// Indicates that the client should continue with its request.
+ /// Contains the values of the HTTP status codes.
///
- Continue = 100,
- ///
- /// Equivalent to status code 101.
- /// Indicates that the server is switching the HTTP version or protocol on the connection.
- ///
- SwitchingProtocols = 101,
- ///
- /// Equivalent to status code 200.
- /// Indicates that the client's request has succeeded.
- ///
- OK = 200,
- ///
- /// Equivalent to status code 201.
- /// Indicates that the client's request has been fulfilled and resulted in a new resource being
- /// created.
- ///
- Created = 201,
- ///
- /// Equivalent to status code 202.
- /// Indicates that the client's request has been accepted for processing, but the processing
- /// hasn't been completed.
- ///
- Accepted = 202,
- ///
- /// Equivalent to status code 203.
- /// Indicates that the returned metainformation is from a local or a third-party copy instead of
- /// the origin server.
- ///
- NonAuthoritativeInformation = 203,
- ///
- /// Equivalent to status code 204.
- /// Indicates that the server has fulfilled the client's request but doesn't need to return
- /// an entity-body.
- ///
- NoContent = 204,
- ///
- /// Equivalent to status code 205.
- /// Indicates that the server has fulfilled the client's request, and the user agent should
- /// reset the document view which caused the request to be sent.
- ///
- ResetContent = 205,
- ///
- /// Equivalent to status code 206.
- /// Indicates that the server has fulfilled the partial GET request for the resource.
- ///
- PartialContent = 206,
- ///
- ///
- /// Equivalent to status code 300.
- /// Indicates that the requested resource corresponds to any of multiple representations.
- ///
- ///
- /// MultipleChoices is a synonym for Ambiguous.
- ///
- ///
- MultipleChoices = 300,
- ///
- ///
- /// Equivalent to status code 300.
- /// Indicates that the requested resource corresponds to any of multiple representations.
- ///
- ///
- /// Ambiguous is a synonym for MultipleChoices.
- ///
- ///
- Ambiguous = 300,
- ///
- ///
- /// Equivalent to status code 301.
- /// Indicates that the requested resource has been assigned a new permanent URI and
- /// any future references to this resource should use one of the returned URIs.
- ///
- ///
- /// MovedPermanently is a synonym for Moved.
- ///
- ///
- MovedPermanently = 301,
- ///
- ///
- /// Equivalent to status code 301.
- /// Indicates that the requested resource has been assigned a new permanent URI and
- /// any future references to this resource should use one of the returned URIs.
- ///
- ///
- /// Moved is a synonym for MovedPermanently.
- ///
- ///
- Moved = 301,
- ///
- ///
- /// Equivalent to status code 302.
- /// Indicates that the requested resource is located temporarily under a different URI.
- ///
- ///
- /// Found is a synonym for Redirect.
- ///
- ///
- Found = 302,
- ///
- ///
- /// Equivalent to status code 302.
- /// Indicates that the requested resource is located temporarily under a different URI.
- ///
- ///
- /// Redirect is a synonym for Found.
- ///
- ///
- Redirect = 302,
- ///
- ///
- /// Equivalent to status code 303.
- /// Indicates that the response to the request can be found under a different URI and
- /// should be retrieved using a GET method on that resource.
- ///
- ///
- /// SeeOther is a synonym for RedirectMethod.
- ///
- ///
- SeeOther = 303,
- ///
- ///
- /// Equivalent to status code 303.
- /// Indicates that the response to the request can be found under a different URI and
- /// should be retrieved using a GET method on that resource.
- ///
- ///
- /// RedirectMethod is a synonym for SeeOther.
- ///
- ///
- RedirectMethod = 303,
- ///
- /// Equivalent to status code 304.
- /// Indicates that the client has performed a conditional GET request and access is allowed,
- /// but the document hasn't been modified.
- ///
- NotModified = 304,
- ///
- /// Equivalent to status code 305.
- /// Indicates that the requested resource must be accessed through the proxy given by
- /// the Location field.
- ///
- UseProxy = 305,
- ///
- /// Equivalent to status code 306.
- /// This status code was used in a previous version of the specification, is no longer used,
- /// and is reserved for future use.
- ///
- Unused = 306,
- ///
- ///
- /// Equivalent to status code 307.
- /// Indicates that the requested resource is located temporarily under a different URI.
- ///
- ///
- /// TemporaryRedirect is a synonym for RedirectKeepVerb.
- ///
- ///
- TemporaryRedirect = 307,
- ///
- ///
- /// Equivalent to status code 307.
- /// Indicates that the requested resource is located temporarily under a different URI.
- ///
- ///
- /// RedirectKeepVerb is a synonym for TemporaryRedirect.
- ///
- ///
- RedirectKeepVerb = 307,
- ///
- /// Equivalent to status code 400.
- /// Indicates that the client's request couldn't be understood by the server due to
- /// malformed syntax.
- ///
- BadRequest = 400,
- ///
- /// Equivalent to status code 401.
- /// Indicates that the client's request requires user authentication.
- ///
- Unauthorized = 401,
- ///
- /// Equivalent to status code 402.
- /// This status code is reserved for future use.
- ///
- PaymentRequired = 402,
- ///
- /// Equivalent to status code 403.
- /// Indicates that the server understood the client's request but is refusing to fulfill it.
- ///
- Forbidden = 403,
- ///
- /// Equivalent to status code 404.
- /// Indicates that the server hasn't found anything matching the request URI.
- ///
- NotFound = 404,
- ///
- /// Equivalent to status code 405.
- /// Indicates that the method specified in the request line isn't allowed for the resource
- /// identified by the request URI.
- ///
- MethodNotAllowed = 405,
- ///
- /// Equivalent to status code 406.
- /// Indicates that the server doesn't have the appropriate resource to respond to the Accept
- /// headers in the client's request.
- ///
- NotAcceptable = 406,
- ///
- /// Equivalent to status code 407.
- /// Indicates that the client must first authenticate itself with the proxy.
- ///
- ProxyAuthenticationRequired = 407,
- ///
- /// Equivalent to status code 408.
- /// Indicates that the client didn't produce a request within the time that the server was
- /// prepared to wait.
- ///
- RequestTimeout = 408,
- ///
- /// Equivalent to status code 409.
- /// Indicates that the client's request couldn't be completed due to a conflict on the server.
- ///
- Conflict = 409,
- ///
- /// Equivalent to status code 410.
- /// Indicates that the requested resource is no longer available at the server and
- /// no forwarding address is known.
- ///
- Gone = 410,
- ///
- /// Equivalent to status code 411.
- /// Indicates that the server refuses to accept the client's request without a defined
- /// Content-Length.
- ///
- LengthRequired = 411,
- ///
- /// Equivalent to status code 412.
- /// Indicates that the precondition given in one or more of the request headers evaluated to
- /// false when it was tested on the server.
- ///
- PreconditionFailed = 412,
- ///
- /// Equivalent to status code 413.
- /// Indicates that the entity of the client's request is larger than the server is willing or
- /// able to process.
- ///
- RequestEntityTooLarge = 413,
- ///
- /// Equivalent to status code 414.
- /// Indicates that the request URI is longer than the server is willing to interpret.
- ///
- RequestUriTooLong = 414,
- ///
- /// Equivalent to status code 415.
- /// Indicates that the entity of the client's request is in a format not supported by
- /// the requested resource for the requested method.
- ///
- UnsupportedMediaType = 415,
- ///
- /// Equivalent to status code 416.
- /// Indicates that none of the range specifier values in a Range request header overlap
- /// the current extent of the selected resource.
- ///
- RequestedRangeNotSatisfiable = 416,
- ///
- /// Equivalent to status code 417.
- /// Indicates that the expectation given in an Expect request header couldn't be met by
- /// the server.
- ///
- ExpectationFailed = 417,
- ///
- /// Equivalent to status code 500.
- /// Indicates that the server encountered an unexpected condition which prevented it from
- /// fulfilling the client's request.
- ///
- InternalServerError = 500,
- ///
- /// Equivalent to status code 501.
- /// Indicates that the server doesn't support the functionality required to fulfill the client's
- /// request.
- ///
- NotImplemented = 501,
- ///
- /// Equivalent to status code 502.
- /// Indicates that a gateway or proxy server received an invalid response from the upstream
- /// server.
- ///
- BadGateway = 502,
- ///
- /// Equivalent to status code 503.
- /// Indicates that the server is currently unable to handle the client's request due to
- /// a temporary overloading or maintenance of the server.
- ///
- ServiceUnavailable = 503,
- ///
- /// Equivalent to status code 504.
- /// Indicates that a gateway or proxy server didn't receive a timely response from the upstream
- /// server or some other auxiliary server.
- ///
- GatewayTimeout = 504,
- ///
- /// Equivalent to status code 505.
- /// Indicates that the server doesn't support the HTTP version used in the client's request.
- ///
- HttpVersionNotSupported = 505,
- }
+ ///
+ /// The HttpStatusCode enumeration contains the values of the HTTP status codes defined in
+ /// RFC 2616 for HTTP 1.1.
+ ///
+ public enum HttpStatusCode
+ {
+ ///
+ /// Equivalent to status code 100.
+ /// Indicates that the client should continue with its request.
+ ///
+ Continue = 100,
+ ///
+ /// Equivalent to status code 101.
+ /// Indicates that the server is switching the HTTP version or protocol on the connection.
+ ///
+ SwitchingProtocols = 101,
+ ///
+ /// Equivalent to status code 200.
+ /// Indicates that the client's request has succeeded.
+ ///
+ OK = 200,
+ ///
+ /// Equivalent to status code 201.
+ /// Indicates that the client's request has been fulfilled and resulted in a new resource being
+ /// created.
+ ///
+ Created = 201,
+ ///
+ /// Equivalent to status code 202.
+ /// Indicates that the client's request has been accepted for processing, but the processing
+ /// hasn't been completed.
+ ///
+ Accepted = 202,
+ ///
+ /// Equivalent to status code 203.
+ /// Indicates that the returned metainformation is from a local or a third-party copy instead of
+ /// the origin server.
+ ///
+ NonAuthoritativeInformation = 203,
+ ///
+ /// Equivalent to status code 204.
+ /// Indicates that the server has fulfilled the client's request but doesn't need to return
+ /// an entity-body.
+ ///
+ NoContent = 204,
+ ///
+ /// Equivalent to status code 205.
+ /// Indicates that the server has fulfilled the client's request, and the user agent should
+ /// reset the document view which caused the request to be sent.
+ ///
+ ResetContent = 205,
+ ///
+ /// Equivalent to status code 206.
+ /// Indicates that the server has fulfilled the partial GET request for the resource.
+ ///
+ PartialContent = 206,
+ ///
+ ///
+ /// Equivalent to status code 300.
+ /// Indicates that the requested resource corresponds to any of multiple representations.
+ ///
+ ///
+ /// MultipleChoices is a synonym for Ambiguous.
+ ///
+ ///
+ MultipleChoices = 300,
+ ///
+ ///
+ /// Equivalent to status code 300.
+ /// Indicates that the requested resource corresponds to any of multiple representations.
+ ///
+ ///
+ /// Ambiguous is a synonym for MultipleChoices.
+ ///
+ ///
+ Ambiguous = 300,
+ ///
+ ///
+ /// Equivalent to status code 301.
+ /// Indicates that the requested resource has been assigned a new permanent URI and
+ /// any future references to this resource should use one of the returned URIs.
+ ///
+ ///
+ /// MovedPermanently is a synonym for Moved.
+ ///
+ ///
+ MovedPermanently = 301,
+ ///
+ ///
+ /// Equivalent to status code 301.
+ /// Indicates that the requested resource has been assigned a new permanent URI and
+ /// any future references to this resource should use one of the returned URIs.
+ ///
+ ///
+ /// Moved is a synonym for MovedPermanently.
+ ///
+ ///
+ Moved = 301,
+ ///
+ ///
+ /// Equivalent to status code 302.
+ /// Indicates that the requested resource is located temporarily under a different URI.
+ ///
+ ///
+ /// Found is a synonym for Redirect.
+ ///
+ ///
+ Found = 302,
+ ///
+ ///
+ /// Equivalent to status code 302.
+ /// Indicates that the requested resource is located temporarily under a different URI.
+ ///
+ ///
+ /// Redirect is a synonym for Found.
+ ///
+ ///
+ Redirect = 302,
+ ///
+ ///
+ /// Equivalent to status code 303.
+ /// Indicates that the response to the request can be found under a different URI and
+ /// should be retrieved using a GET method on that resource.
+ ///
+ ///
+ /// SeeOther is a synonym for RedirectMethod.
+ ///
+ ///
+ SeeOther = 303,
+ ///
+ ///
+ /// Equivalent to status code 303.
+ /// Indicates that the response to the request can be found under a different URI and
+ /// should be retrieved using a GET method on that resource.
+ ///
+ ///
+ /// RedirectMethod is a synonym for SeeOther.
+ ///
+ ///
+ RedirectMethod = 303,
+ ///
+ /// Equivalent to status code 304.
+ /// Indicates that the client has performed a conditional GET request and access is allowed,
+ /// but the document hasn't been modified.
+ ///
+ NotModified = 304,
+ ///
+ /// Equivalent to status code 305.
+ /// Indicates that the requested resource must be accessed through the proxy given by
+ /// the Location field.
+ ///
+ UseProxy = 305,
+ ///
+ /// Equivalent to status code 306.
+ /// This status code was used in a previous version of the specification, is no longer used,
+ /// and is reserved for future use.
+ ///
+ Unused = 306,
+ ///
+ ///
+ /// Equivalent to status code 307.
+ /// Indicates that the requested resource is located temporarily under a different URI.
+ ///
+ ///
+ /// TemporaryRedirect is a synonym for RedirectKeepVerb.
+ ///
+ ///
+ TemporaryRedirect = 307,
+ ///
+ ///
+ /// Equivalent to status code 307.
+ /// Indicates that the requested resource is located temporarily under a different URI.
+ ///
+ ///
+ /// RedirectKeepVerb is a synonym for TemporaryRedirect.
+ ///
+ ///
+ RedirectKeepVerb = 307,
+ ///
+ /// Equivalent to status code 400.
+ /// Indicates that the client's request couldn't be understood by the server due to
+ /// malformed syntax.
+ ///
+ BadRequest = 400,
+ ///
+ /// Equivalent to status code 401.
+ /// Indicates that the client's request requires user authentication.
+ ///
+ Unauthorized = 401,
+ ///
+ /// Equivalent to status code 402.
+ /// This status code is reserved for future use.
+ ///
+ PaymentRequired = 402,
+ ///
+ /// Equivalent to status code 403.
+ /// Indicates that the server understood the client's request but is refusing to fulfill it.
+ ///
+ Forbidden = 403,
+ ///
+ /// Equivalent to status code 404.
+ /// Indicates that the server hasn't found anything matching the request URI.
+ ///
+ NotFound = 404,
+ ///
+ /// Equivalent to status code 405.
+ /// Indicates that the method specified in the request line isn't allowed for the resource
+ /// identified by the request URI.
+ ///
+ MethodNotAllowed = 405,
+ ///
+ /// Equivalent to status code 406.
+ /// Indicates that the server doesn't have the appropriate resource to respond to the Accept
+ /// headers in the client's request.
+ ///
+ NotAcceptable = 406,
+ ///
+ /// Equivalent to status code 407.
+ /// Indicates that the client must first authenticate itself with the proxy.
+ ///
+ ProxyAuthenticationRequired = 407,
+ ///
+ /// Equivalent to status code 408.
+ /// Indicates that the client didn't produce a request within the time that the server was
+ /// prepared to wait.
+ ///
+ RequestTimeout = 408,
+ ///
+ /// Equivalent to status code 409.
+ /// Indicates that the client's request couldn't be completed due to a conflict on the server.
+ ///
+ Conflict = 409,
+ ///
+ /// Equivalent to status code 410.
+ /// Indicates that the requested resource is no longer available at the server and
+ /// no forwarding address is known.
+ ///
+ Gone = 410,
+ ///
+ /// Equivalent to status code 411.
+ /// Indicates that the server refuses to accept the client's request without a defined
+ /// Content-Length.
+ ///
+ LengthRequired = 411,
+ ///
+ /// Equivalent to status code 412.
+ /// Indicates that the precondition given in one or more of the request headers evaluated to
+ /// false when it was tested on the server.
+ ///
+ PreconditionFailed = 412,
+ ///
+ /// Equivalent to status code 413.
+ /// Indicates that the entity of the client's request is larger than the server is willing or
+ /// able to process.
+ ///
+ RequestEntityTooLarge = 413,
+ ///
+ /// Equivalent to status code 414.
+ /// Indicates that the request URI is longer than the server is willing to interpret.
+ ///
+ RequestUriTooLong = 414,
+ ///
+ /// Equivalent to status code 415.
+ /// Indicates that the entity of the client's request is in a format not supported by
+ /// the requested resource for the requested method.
+ ///
+ UnsupportedMediaType = 415,
+ ///
+ /// Equivalent to status code 416.
+ /// Indicates that none of the range specifier values in a Range request header overlap
+ /// the current extent of the selected resource.
+ ///
+ RequestedRangeNotSatisfiable = 416,
+ ///
+ /// Equivalent to status code 417.
+ /// Indicates that the expectation given in an Expect request header couldn't be met by
+ /// the server.
+ ///
+ ExpectationFailed = 417,
+ ///
+ /// Equivalent to status code 500.
+ /// Indicates that the server encountered an unexpected condition which prevented it from
+ /// fulfilling the client's request.
+ ///
+ InternalServerError = 500,
+ ///
+ /// Equivalent to status code 501.
+ /// Indicates that the server doesn't support the functionality required to fulfill the client's
+ /// request.
+ ///
+ NotImplemented = 501,
+ ///
+ /// Equivalent to status code 502.
+ /// Indicates that a gateway or proxy server received an invalid response from the upstream
+ /// server.
+ ///
+ BadGateway = 502,
+ ///
+ /// Equivalent to status code 503.
+ /// Indicates that the server is currently unable to handle the client's request due to
+ /// a temporary overloading or maintenance of the server.
+ ///
+ ServiceUnavailable = 503,
+ ///
+ /// Equivalent to status code 504.
+ /// Indicates that a gateway or proxy server didn't receive a timely response from the upstream
+ /// server or some other auxiliary server.
+ ///
+ GatewayTimeout = 504,
+ ///
+ /// Equivalent to status code 505.
+ /// Indicates that the server doesn't support the HTTP version used in the client's request.
+ ///
+ HttpVersionNotSupported = 505,
+ }
}
diff --git a/SocketHttpListener/Net/HttpStatusDescription.cs b/SocketHttpListener/Net/HttpStatusDescription.cs
index 9cc4a8e8ce..d0587dff73 100644
--- a/SocketHttpListener/Net/HttpStatusDescription.cs
+++ b/SocketHttpListener/Net/HttpStatusDescription.cs
@@ -1,9 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace SocketHttpListener.Net
+namespace SocketHttpListener.Net
{
internal static class HttpStatusDescription
{
diff --git a/SocketHttpListener/Net/ListenerPrefix.cs b/SocketHttpListener/Net/ListenerPrefix.cs
index 99bb118e52..b29cc5c6db 100644
--- a/SocketHttpListener/Net/ListenerPrefix.cs
+++ b/SocketHttpListener/Net/ListenerPrefix.cs
@@ -1,6 +1,5 @@
using System;
using System.Net;
-using MediaBrowser.Model.Net;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/UriScheme.cs b/SocketHttpListener/Net/UriScheme.cs
index 732fc0e7df..0e747154f0 100644
--- a/SocketHttpListener/Net/UriScheme.cs
+++ b/SocketHttpListener/Net/UriScheme.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace SocketHttpListener.Net
+namespace SocketHttpListener.Net
{
internal static class UriScheme
{
diff --git a/SocketHttpListener/Net/WebHeaderCollection.cs b/SocketHttpListener/Net/WebHeaderCollection.cs
index ed3cb921ce..8c3395df5c 100644
--- a/SocketHttpListener/Net/WebHeaderCollection.cs
+++ b/SocketHttpListener/Net/WebHeaderCollection.cs
@@ -1,13 +1,8 @@
using System;
-using System.Collections;
using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Net;
using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
using System.Text;
using MediaBrowser.Model.Services;
-using MediaBrowser.Model.Extensions;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/WebHeaderEncoding.cs b/SocketHttpListener/Net/WebHeaderEncoding.cs
index 7290bfc63b..a269b1eaf7 100644
--- a/SocketHttpListener/Net/WebHeaderEncoding.cs
+++ b/SocketHttpListener/Net/WebHeaderEncoding.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
+using System.Text;
namespace SocketHttpListener.Net
{
diff --git a/SocketHttpListener/Net/WebSockets/HttpListenerWebSocketContext.cs b/SocketHttpListener/Net/WebSockets/HttpListenerWebSocketContext.cs
index 49375678dd..5ed49ec47d 100644
--- a/SocketHttpListener/Net/WebSockets/HttpListenerWebSocketContext.cs
+++ b/SocketHttpListener/Net/WebSockets/HttpListenerWebSocketContext.cs
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.IO;
using System.Net;
using System.Security.Principal;
-using MediaBrowser.Model.Cryptography;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Net;
using MediaBrowser.Model.Services;
-using SocketHttpListener.Primitives;
namespace SocketHttpListener.Net.WebSockets
{
diff --git a/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs b/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs
index 571e4bdbae..96b960f7b9 100644
--- a/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs
+++ b/SocketHttpListener/Net/WebSockets/HttpWebSocket.Managed.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.Threading.Tasks;
namespace SocketHttpListener.Net.WebSockets
diff --git a/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs b/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs
index f72a139f3a..4667275c5e 100644
--- a/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs
+++ b/SocketHttpListener/Net/WebSockets/HttpWebSocket.cs
@@ -1,8 +1,7 @@
using System;
-using System.Collections.Generic;
-using System.Text;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography;
+using System.Text;
using System.Threading;
namespace SocketHttpListener.Net.WebSockets
diff --git a/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs b/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs
index b83b6cd0f7..451b16ec30 100644
--- a/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs
+++ b/SocketHttpListener/Net/WebSockets/WebSocketCloseStatus.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace SocketHttpListener.Net.WebSockets
+namespace SocketHttpListener.Net.WebSockets
{
public enum WebSocketCloseStatus
{
diff --git a/SocketHttpListener/Net/WebSockets/WebSocketContext.cs b/SocketHttpListener/Net/WebSockets/WebSocketContext.cs
index 071b5fe05b..10ad864398 100644
--- a/SocketHttpListener/Net/WebSockets/WebSocketContext.cs
+++ b/SocketHttpListener/Net/WebSockets/WebSocketContext.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
using System.Net;
using System.Security.Principal;
-using MediaBrowser.Model.Net;
using MediaBrowser.Model.Services;
namespace SocketHttpListener.Net.WebSockets
diff --git a/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs b/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs
index 00895ea015..2f1b428abb 100644
--- a/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs
+++ b/SocketHttpListener/Net/WebSockets/WebSocketValidate.cs
@@ -1,8 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.Text;
-using MediaBrowser.Model.Net;
using System.Globalization;
+using System.Text;
using WebSocketState = System.Net.WebSockets.WebSocketState;
namespace SocketHttpListener.Net.WebSockets
diff --git a/SocketHttpListener/Opcode.cs b/SocketHttpListener/Opcode.cs
index 62b7d8585c..69cf3f3728 100644
--- a/SocketHttpListener/Opcode.cs
+++ b/SocketHttpListener/Opcode.cs
@@ -1,43 +1,43 @@
namespace SocketHttpListener
{
- ///
- /// Contains the values of the opcode that indicates the type of a WebSocket frame.
- ///
- ///
- /// The values of the opcode are defined in
- /// Section 5.2 of RFC 6455.
- ///
- public enum Opcode : byte
- {
///
- /// Equivalent to numeric value 0.
- /// Indicates a continuation frame.
+ /// Contains the values of the opcode that indicates the type of a WebSocket frame.
///
- Cont = 0x0,
- ///
- /// Equivalent to numeric value 1.
- /// Indicates a text frame.
- ///
- Text = 0x1,
- ///
- /// Equivalent to numeric value 2.
- /// Indicates a binary frame.
- ///
- Binary = 0x2,
- ///
- /// Equivalent to numeric value 8.
- /// Indicates a connection close frame.
- ///
- Close = 0x8,
- ///
- /// Equivalent to numeric value 9.
- /// Indicates a ping frame.
- ///
- Ping = 0x9,
- ///
- /// Equivalent to numeric value 10.
- /// Indicates a pong frame.
- ///
- Pong = 0xa
- }
+ ///
+ /// The values of the opcode are defined in
+ /// Section 5.2 of RFC 6455.
+ ///
+ public enum Opcode : byte
+ {
+ ///
+ /// Equivalent to numeric value 0.
+ /// Indicates a continuation frame.
+ ///
+ Cont = 0x0,
+ ///
+ /// Equivalent to numeric value 1.
+ /// Indicates a text frame.
+ ///
+ Text = 0x1,
+ ///
+ /// Equivalent to numeric value 2.
+ /// Indicates a binary frame.
+ ///
+ Binary = 0x2,
+ ///
+ /// Equivalent to numeric value 8.
+ /// Indicates a connection close frame.
+ ///
+ Close = 0x8,
+ ///
+ /// Equivalent to numeric value 9.
+ /// Indicates a ping frame.
+ ///
+ Ping = 0x9,
+ ///
+ /// Equivalent to numeric value 10.
+ /// Indicates a pong frame.
+ ///
+ Pong = 0xa
+ }
}
diff --git a/SocketHttpListener/PayloadData.cs b/SocketHttpListener/PayloadData.cs
index a6318da2b8..829db63042 100644
--- a/SocketHttpListener/PayloadData.cs
+++ b/SocketHttpListener/PayloadData.cs
@@ -5,145 +5,155 @@ using System.Text;
namespace SocketHttpListener
{
- internal class PayloadData : IEnumerable
- {
- #region Private Fields
-
- private byte [] _applicationData;
- private byte [] _extensionData;
- private bool _masked;
-
- #endregion
-
- #region Public Const Fields
-
- public const ulong MaxLength = long.MaxValue;
-
- #endregion
-
- #region Public Constructors
-
- public PayloadData ()
- : this (new byte [0], new byte [0], false)
+ internal class PayloadData : IEnumerable
{
+ #region Private Fields
+
+ private byte[] _applicationData;
+ private byte[] _extensionData;
+ private bool _masked;
+
+ #endregion
+
+ #region Public Const Fields
+
+ public const ulong MaxLength = long.MaxValue;
+
+ #endregion
+
+ #region Public Constructors
+
+ public PayloadData()
+ : this(new byte[0], new byte[0], false)
+ {
+ }
+
+ public PayloadData(byte[] applicationData)
+ : this(new byte[0], applicationData, false)
+ {
+ }
+
+ public PayloadData(string applicationData)
+ : this(new byte[0], Encoding.UTF8.GetBytes(applicationData), false)
+ {
+ }
+
+ public PayloadData(byte[] applicationData, bool masked)
+ : this(new byte[0], applicationData, masked)
+ {
+ }
+
+ public PayloadData(byte[] extensionData, byte[] applicationData, bool masked)
+ {
+ _extensionData = extensionData;
+ _applicationData = applicationData;
+ _masked = masked;
+ }
+
+ #endregion
+
+ #region Internal Properties
+
+ internal bool ContainsReservedCloseStatusCode
+ {
+ get
+ {
+ return _applicationData.Length > 1 &&
+ _applicationData.SubArray(0, 2).ToUInt16(ByteOrder.Big).IsReserved();
+ }
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ public byte[] ApplicationData
+ {
+ get
+ {
+ return _applicationData;
+ }
+ }
+
+ public byte[] ExtensionData
+ {
+ get
+ {
+ return _extensionData;
+ }
+ }
+
+ public bool IsMasked
+ {
+ get
+ {
+ return _masked;
+ }
+ }
+
+ public ulong Length
+ {
+ get
+ {
+ return (ulong)(_extensionData.Length + _applicationData.Length);
+ }
+ }
+
+ #endregion
+
+ #region Private Methods
+
+ private static void mask(byte[] src, byte[] key)
+ {
+ for (long i = 0; i < src.Length; i++)
+ src[i] = (byte)(src[i] ^ key[i % 4]);
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public IEnumerator GetEnumerator()
+ {
+ foreach (byte b in _extensionData)
+ yield return b;
+
+ foreach (byte b in _applicationData)
+ yield return b;
+ }
+
+ public void Mask(byte[] maskingKey)
+ {
+ if (_extensionData.Length > 0)
+ mask(_extensionData, maskingKey);
+
+ if (_applicationData.Length > 0)
+ mask(_applicationData, maskingKey);
+
+ _masked = !_masked;
+ }
+
+ public byte[] ToByteArray()
+ {
+ return _extensionData.Length > 0
+ ? new List(this).ToArray()
+ : _applicationData;
+ }
+
+ public override string ToString()
+ {
+ return BitConverter.ToString(ToByteArray());
+ }
+
+ #endregion
+
+ #region Explicitly Implemented Interface Members
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ #endregion
}
-
- public PayloadData (byte [] applicationData)
- : this (new byte [0], applicationData, false)
- {
- }
-
- public PayloadData (string applicationData)
- : this (new byte [0], Encoding.UTF8.GetBytes (applicationData), false)
- {
- }
-
- public PayloadData (byte [] applicationData, bool masked)
- : this (new byte [0], applicationData, masked)
- {
- }
-
- public PayloadData (byte [] extensionData, byte [] applicationData, bool masked)
- {
- _extensionData = extensionData;
- _applicationData = applicationData;
- _masked = masked;
- }
-
- #endregion
-
- #region Internal Properties
-
- internal bool ContainsReservedCloseStatusCode {
- get {
- return _applicationData.Length > 1 &&
- _applicationData.SubArray (0, 2).ToUInt16 (ByteOrder.Big).IsReserved ();
- }
- }
-
- #endregion
-
- #region Public Properties
-
- public byte [] ApplicationData {
- get {
- return _applicationData;
- }
- }
-
- public byte [] ExtensionData {
- get {
- return _extensionData;
- }
- }
-
- public bool IsMasked {
- get {
- return _masked;
- }
- }
-
- public ulong Length {
- get {
- return (ulong) (_extensionData.Length + _applicationData.Length);
- }
- }
-
- #endregion
-
- #region Private Methods
-
- private static void mask (byte [] src, byte [] key)
- {
- for (long i = 0; i < src.Length; i++)
- src [i] = (byte) (src [i] ^ key [i % 4]);
- }
-
- #endregion
-
- #region Public Methods
-
- public IEnumerator GetEnumerator ()
- {
- foreach (byte b in _extensionData)
- yield return b;
-
- foreach (byte b in _applicationData)
- yield return b;
- }
-
- public void Mask (byte [] maskingKey)
- {
- if (_extensionData.Length > 0)
- mask (_extensionData, maskingKey);
-
- if (_applicationData.Length > 0)
- mask (_applicationData, maskingKey);
-
- _masked = !_masked;
- }
-
- public byte [] ToByteArray ()
- {
- return _extensionData.Length > 0
- ? new List (this).ToArray ()
- : _applicationData;
- }
-
- public override string ToString ()
- {
- return BitConverter.ToString (ToByteArray ());
- }
-
- #endregion
-
- #region Explicitly Implemented Interface Members
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return GetEnumerator ();
- }
-
- #endregion
- }
}
diff --git a/SocketHttpListener/Primitives/ITextEncoding.cs b/SocketHttpListener/Primitives/ITextEncoding.cs
index a256a077dc..f543cf4a54 100644
--- a/SocketHttpListener/Primitives/ITextEncoding.cs
+++ b/SocketHttpListener/Primitives/ITextEncoding.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
+using System.Text;
using MediaBrowser.Model.Text;
namespace SocketHttpListener.Primitives
diff --git a/SocketHttpListener/Rsv.cs b/SocketHttpListener/Rsv.cs
index 668059b8a3..87283791ec 100644
--- a/SocketHttpListener/Rsv.cs
+++ b/SocketHttpListener/Rsv.cs
@@ -1,8 +1,8 @@
namespace SocketHttpListener
{
- internal enum Rsv : byte
- {
- Off = 0x0,
- On = 0x1
- }
+ internal enum Rsv : byte
+ {
+ Off = 0x0,
+ On = 0x1
+ }
}
diff --git a/SocketHttpListener/SocketStream.cs b/SocketHttpListener/SocketStream.cs
index a4f31eab9b..198fd36f2f 100644
--- a/SocketHttpListener/SocketStream.cs
+++ b/SocketHttpListener/SocketStream.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Net.Sockets;
-using System.Text;
-using System.Threading.Tasks;
namespace SocketHttpListener
{
diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs
index d926a58c92..98b9c776d5 100644
--- a/SocketHttpListener/WebSocket.cs
+++ b/SocketHttpListener/WebSocket.cs
@@ -3,15 +3,12 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
+using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Model.Cryptography;
-using MediaBrowser.Model.IO;
using SocketHttpListener.Net.WebSockets;
-using SocketHttpListener.Primitives;
using HttpStatusCode = SocketHttpListener.Net.HttpStatusCode;
-using System.Net.Sockets;
using WebSocketState = System.Net.WebSockets.WebSocketState;
namespace SocketHttpListener
diff --git a/SocketHttpListener/WebSocketException.cs b/SocketHttpListener/WebSocketException.cs
index 260721317c..e86c46d0f5 100644
--- a/SocketHttpListener/WebSocketException.cs
+++ b/SocketHttpListener/WebSocketException.cs
@@ -2,59 +2,60 @@ using System;
namespace SocketHttpListener
{
- ///
- /// The exception that is thrown when a gets a fatal error.
- ///
- public class WebSocketException : Exception
- {
- #region Internal Constructors
-
- internal WebSocketException ()
- : this (CloseStatusCode.Abnormal, null, null)
- {
- }
-
- internal WebSocketException (string message)
- : this (CloseStatusCode.Abnormal, message, null)
- {
- }
-
- internal WebSocketException (CloseStatusCode code)
- : this (code, null, null)
- {
- }
-
- internal WebSocketException (string message, Exception innerException)
- : this (CloseStatusCode.Abnormal, message, innerException)
- {
- }
-
- internal WebSocketException (CloseStatusCode code, string message)
- : this (code, message, null)
- {
- }
-
- internal WebSocketException (CloseStatusCode code, string message, Exception innerException)
- : base (message ?? code.GetMessage (), innerException)
- {
- Code = code;
- }
-
- #endregion
-
- #region Public Properties
-
///
- /// Gets the status code indicating the cause for the exception.
+ /// The exception that is thrown when a gets a fatal error.
///
- ///
- /// One of the enum values, represents the status code indicating
- /// the cause for the exception.
- ///
- public CloseStatusCode Code {
- get; private set;
- }
+ public class WebSocketException : Exception
+ {
+ #region Internal Constructors
- #endregion
- }
+ internal WebSocketException()
+ : this(CloseStatusCode.Abnormal, null, null)
+ {
+ }
+
+ internal WebSocketException(string message)
+ : this(CloseStatusCode.Abnormal, message, null)
+ {
+ }
+
+ internal WebSocketException(CloseStatusCode code)
+ : this(code, null, null)
+ {
+ }
+
+ internal WebSocketException(string message, Exception innerException)
+ : this(CloseStatusCode.Abnormal, message, innerException)
+ {
+ }
+
+ internal WebSocketException(CloseStatusCode code, string message)
+ : this(code, message, null)
+ {
+ }
+
+ internal WebSocketException(CloseStatusCode code, string message, Exception innerException)
+ : base(message ?? code.GetMessage(), innerException)
+ {
+ Code = code;
+ }
+
+ #endregion
+
+ #region Public Properties
+
+ ///
+ /// Gets the status code indicating the cause for the exception.
+ ///
+ ///
+ /// One of the enum values, represents the status code indicating
+ /// the cause for the exception.
+ ///
+ public CloseStatusCode Code
+ {
+ get; private set;
+ }
+
+ #endregion
+ }
}
diff --git a/SocketHttpListener/WebSocketFrame.cs b/SocketHttpListener/WebSocketFrame.cs
index 44fa4a5dc3..71543d36b2 100644
--- a/SocketHttpListener/WebSocketFrame.cs
+++ b/SocketHttpListener/WebSocketFrame.cs
@@ -2,7 +2,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
-using System.Text;
namespace SocketHttpListener
{