aboutsummaryrefslogtreecommitdiff
path: root/SocketHttpListener
diff options
context:
space:
mode:
Diffstat (limited to 'SocketHttpListener')
-rw-r--r--SocketHttpListener/CloseEventArgs.cs26
-rw-r--r--SocketHttpListener/ErrorEventArgs.cs8
-rw-r--r--SocketHttpListener/HttpBase.cs16
-rw-r--r--SocketHttpListener/HttpResponse.cs40
-rw-r--r--SocketHttpListener/MessageEventArgs.cs24
-rw-r--r--SocketHttpListener/Net/ChunkStream.cs15
-rw-r--r--SocketHttpListener/Net/ChunkedInputStream.cs4
-rw-r--r--SocketHttpListener/Net/HttpConnection.cs32
-rw-r--r--SocketHttpListener/Net/HttpEndPointListener.cs8
-rw-r--r--SocketHttpListener/Net/HttpListener.cs23
-rw-r--r--SocketHttpListener/Net/HttpListenerBasicIdentity.cs29
-rw-r--r--SocketHttpListener/Net/HttpListenerContext.cs16
-rw-r--r--SocketHttpListener/Net/HttpListenerPrefixCollection.cs15
-rw-r--r--SocketHttpListener/Net/HttpListenerResponse.Managed.cs4
-rw-r--r--SocketHttpListener/Net/HttpListenerResponse.cs27
-rw-r--r--SocketHttpListener/Net/HttpRequestStream.cs18
-rw-r--r--SocketHttpListener/Net/HttpResponseStream.cs18
-rw-r--r--SocketHttpListener/Net/HttpStreamAsyncResult.cs5
-rw-r--r--SocketHttpListener/Net/ListenerPrefix.cs24
-rw-r--r--SocketHttpListener/PayloadData.cs43
-rw-r--r--SocketHttpListener/SocketStream.cs28
-rw-r--r--SocketHttpListener/WebSocket.cs14
-rw-r--r--SocketHttpListener/WebSocketFrame.cs192
23 files changed, 114 insertions, 515 deletions
diff --git a/SocketHttpListener/CloseEventArgs.cs b/SocketHttpListener/CloseEventArgs.cs
index 12a24bb4a..c6460fd23 100644
--- a/SocketHttpListener/CloseEventArgs.cs
+++ b/SocketHttpListener/CloseEventArgs.cs
@@ -51,13 +51,7 @@ namespace SocketHttpListener
/// <value>
/// A <see cref="ushort"/> that represents the status code for the close if any.
/// </value>
- public ushort Code
- {
- get
- {
- return _code;
- }
- }
+ public ushort Code => _code;
/// <summary>
/// Gets the reason for the close.
@@ -65,13 +59,7 @@ namespace SocketHttpListener
/// <value>
/// A <see cref="string"/> that represents the reason for the close if any.
/// </value>
- public string Reason
- {
- get
- {
- return _reason;
- }
- }
+ public string Reason => _reason;
/// <summary>
/// Gets a value indicating whether the WebSocket connection has been closed cleanly.
@@ -81,15 +69,9 @@ namespace SocketHttpListener
/// </value>
public bool WasClean
{
- get
- {
- return _clean;
- }
+ get => _clean;
- internal set
- {
- _clean = value;
- }
+ internal set => _clean = value;
}
#endregion
diff --git a/SocketHttpListener/ErrorEventArgs.cs b/SocketHttpListener/ErrorEventArgs.cs
index 6a85feb9c..9502d2a15 100644
--- a/SocketHttpListener/ErrorEventArgs.cs
+++ b/SocketHttpListener/ErrorEventArgs.cs
@@ -35,13 +35,7 @@ namespace SocketHttpListener
/// <value>
/// A <see cref="string"/> that represents the error message.
/// </value>
- public string Message
- {
- get
- {
- return _message;
- }
- }
+ public string Message => _message;
#endregion
}
diff --git a/SocketHttpListener/HttpBase.cs b/SocketHttpListener/HttpBase.cs
index cc484ccda..fea91d84b 100644
--- a/SocketHttpListener/HttpBase.cs
+++ b/SocketHttpListener/HttpBase.cs
@@ -49,21 +49,9 @@ namespace SocketHttpListener
}
}
- public QueryParamCollection Headers
- {
- get
- {
- return _headers;
- }
- }
+ public QueryParamCollection Headers => _headers;
- public Version ProtocolVersion
- {
- get
- {
- return _version;
- }
- }
+ public Version ProtocolVersion => _version;
#endregion
diff --git a/SocketHttpListener/HttpResponse.cs b/SocketHttpListener/HttpResponse.cs
index 24befccb3..bcfa4a906 100644
--- a/SocketHttpListener/HttpResponse.cs
+++ b/SocketHttpListener/HttpResponse.cs
@@ -46,13 +46,7 @@ namespace SocketHttpListener
#region Public Properties
- public CookieCollection Cookies
- {
- get
- {
- return GetCookies(Headers, true);
- }
- }
+ public CookieCollection Cookies => GetCookies(Headers, true);
private static CookieCollection GetCookies(QueryParamCollection headers, bool response)
{
@@ -62,21 +56,9 @@ namespace SocketHttpListener
: CookieHelper.Parse(headers[name], response);
}
- public bool IsProxyAuthenticationRequired
- {
- get
- {
- return _code == "407";
- }
- }
+ public bool IsProxyAuthenticationRequired => _code == "407";
- public bool IsUnauthorized
- {
- get
- {
- return _code == "401";
- }
- }
+ public bool IsUnauthorized => _code == "401";
public bool IsWebSocketResponse
{
@@ -90,21 +72,9 @@ namespace SocketHttpListener
}
}
- public string Reason
- {
- get
- {
- return _reason;
- }
- }
+ public string Reason => _reason;
- public string StatusCode
- {
- get
- {
- return _code;
- }
- }
+ public string StatusCode => _code;
#endregion
diff --git a/SocketHttpListener/MessageEventArgs.cs b/SocketHttpListener/MessageEventArgs.cs
index 5ee4099b8..d9bccbf3f 100644
--- a/SocketHttpListener/MessageEventArgs.cs
+++ b/SocketHttpListener/MessageEventArgs.cs
@@ -48,13 +48,7 @@ namespace SocketHttpListener
/// <value>
/// A <see cref="string"/> that contains the received data.
/// </value>
- public string Data
- {
- get
- {
- return _data;
- }
- }
+ public string Data => _data;
/// <summary>
/// Gets the received data as an array of <see cref="byte"/>.
@@ -62,13 +56,7 @@ namespace SocketHttpListener
/// <value>
/// An array of <see cref="byte"/> that contains the received data.
/// </value>
- public byte[] RawData
- {
- get
- {
- return _rawData;
- }
- }
+ public byte[] RawData => _rawData;
/// <summary>
/// Gets the type of the received data.
@@ -76,13 +64,7 @@ namespace SocketHttpListener
/// <value>
/// One of the <see cref="Opcode"/> values, indicates the type of the received data.
/// </value>
- public Opcode Type
- {
- get
- {
- return _opcode;
- }
- }
+ public Opcode Type => _opcode;
#endregion
diff --git a/SocketHttpListener/Net/ChunkStream.cs b/SocketHttpListener/Net/ChunkStream.cs
index b9b5edb38..4bf3a6dea 100644
--- a/SocketHttpListener/Net/ChunkStream.cs
+++ b/SocketHttpListener/Net/ChunkStream.cs
@@ -180,10 +180,7 @@ namespace SocketHttpListener.Net
InternalWrite(buffer, ref offset, size);
}
- public bool WantMore
- {
- get { return (_chunkRead != _chunkSize || _chunkSize != 0 || _state != State.None); }
- }
+ public bool WantMore => (_chunkRead != _chunkSize || _chunkSize != 0 || _state != State.None);
public bool DataAvailable
{
@@ -202,15 +199,9 @@ namespace SocketHttpListener.Net
}
}
- public int TotalDataSize
- {
- get { return _totalWritten; }
- }
+ public int TotalDataSize => _totalWritten;
- public int ChunkLeft
- {
- get { return _chunkSize - _chunkRead; }
- }
+ public int ChunkLeft => _chunkSize - _chunkRead;
private State ReadBody(byte[] buffer, ref int offset, int size)
{
diff --git a/SocketHttpListener/Net/ChunkedInputStream.cs b/SocketHttpListener/Net/ChunkedInputStream.cs
index e74c64e54..cdf7ac649 100644
--- a/SocketHttpListener/Net/ChunkedInputStream.cs
+++ b/SocketHttpListener/Net/ChunkedInputStream.cs
@@ -67,8 +67,8 @@ namespace SocketHttpListener.Net
public ChunkStream Decoder
{
- get { return _decoder; }
- set { _decoder = value; }
+ get => _decoder;
+ set => _decoder = value;
}
protected override int ReadCore(byte[] buffer, int offset, int count)
diff --git a/SocketHttpListener/Net/HttpConnection.cs b/SocketHttpListener/Net/HttpConnection.cs
index 86f9dc635..f6db5f0b2 100644
--- a/SocketHttpListener/Net/HttpConnection.cs
+++ b/SocketHttpListener/Net/HttpConnection.cs
@@ -89,13 +89,7 @@ namespace SocketHttpListener.Net
}
}
- public Stream Stream
- {
- get
- {
- return _stream;
- }
- }
+ public Stream Stream => _stream;
public async Task Init()
{
@@ -131,15 +125,9 @@ namespace SocketHttpListener.Net
_context = new HttpListenerContext(this, _textEncoding);
}
- public bool IsClosed
- {
- get { return (_socket == null); }
- }
+ public bool IsClosed => (_socket == null);
- public int Reuses
- {
- get { return _reuses; }
- }
+ public int Reuses => _reuses;
public IPEndPoint LocalEndPoint
{
@@ -153,20 +141,14 @@ namespace SocketHttpListener.Net
}
}
- public IPEndPoint RemoteEndPoint
- {
- get { return _socket.RemoteEndPoint as IPEndPoint; }
- }
+ public IPEndPoint RemoteEndPoint => _socket.RemoteEndPoint as IPEndPoint;
- public bool IsSecure
- {
- get { return secure; }
- }
+ public bool IsSecure => secure;
public ListenerPrefix Prefix
{
- get { return _prefix; }
- set { _prefix = value; }
+ get => _prefix;
+ set => _prefix = value;
}
private void OnTimeout(object unused)
diff --git a/SocketHttpListener/Net/HttpEndPointListener.cs b/SocketHttpListener/Net/HttpEndPointListener.cs
index ee6ddaa84..0f1ce696f 100644
--- a/SocketHttpListener/Net/HttpEndPointListener.cs
+++ b/SocketHttpListener/Net/HttpEndPointListener.cs
@@ -58,13 +58,7 @@ namespace SocketHttpListener.Net
CreateSocket();
}
- internal HttpListener Listener
- {
- get
- {
- return _listener;
- }
- }
+ internal HttpListener Listener => _listener;
private void CreateSocket()
{
diff --git a/SocketHttpListener/Net/HttpListener.cs b/SocketHttpListener/Net/HttpListener.cs
index 4e2239a1a..8ec6b89aa 100644
--- a/SocketHttpListener/Net/HttpListener.cs
+++ b/SocketHttpListener/Net/HttpListener.cs
@@ -70,7 +70,7 @@ namespace SocketHttpListener.Net
// TODO: Digest, NTLM and Negotiate require ControlPrincipal
public AuthenticationSchemes AuthenticationSchemes
{
- get { return auth_schemes; }
+ get => auth_schemes;
set
{
CheckDisposed();
@@ -80,7 +80,7 @@ namespace SocketHttpListener.Net
public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate
{
- get { return auth_selector; }
+ get => auth_selector;
set
{
CheckDisposed();
@@ -88,15 +88,9 @@ namespace SocketHttpListener.Net
}
}
- public bool IsListening
- {
- get { return listening; }
- }
+ public bool IsListening => listening;
- public static bool IsSupported
- {
- get { return true; }
- }
+ public static bool IsSupported => true;
public HttpListenerPrefixCollection Prefixes
{
@@ -110,7 +104,7 @@ namespace SocketHttpListener.Net
// TODO: use this
public string Realm
{
- get { return realm; }
+ get => realm;
set
{
CheckDisposed();
@@ -120,7 +114,7 @@ namespace SocketHttpListener.Net
public bool UnsafeConnectionNtlmAuthentication
{
- get { return unsafe_ntlm_auth; }
+ get => unsafe_ntlm_auth;
set
{
CheckDisposed();
@@ -142,10 +136,7 @@ namespace SocketHttpListener.Net
// }
//}
- internal X509Certificate Certificate
- {
- get { return _certificate; }
- }
+ internal X509Certificate Certificate => _certificate;
public void Abort()
{
diff --git a/SocketHttpListener/Net/HttpListenerBasicIdentity.cs b/SocketHttpListener/Net/HttpListenerBasicIdentity.cs
index 391fc931e..5f6ec44b9 100644
--- a/SocketHttpListener/Net/HttpListenerBasicIdentity.cs
+++ b/SocketHttpListener/Net/HttpListenerBasicIdentity.cs
@@ -12,10 +12,7 @@ namespace SocketHttpListener.Net
this.password = password;
}
- public virtual string Password
- {
- get { return password; }
- }
+ public virtual string Password => password;
}
public class GenericIdentity : IIdentity
@@ -43,28 +40,10 @@ namespace SocketHttpListener.Net
m_type = type;
}
- public virtual string Name
- {
- get
- {
- return m_name;
- }
- }
+ public virtual string Name => m_name;
- public virtual string AuthenticationType
- {
- get
- {
- return m_type;
- }
- }
+ public virtual string AuthenticationType => m_type;
- public virtual bool IsAuthenticated
- {
- get
- {
- return !m_name.Equals("");
- }
- }
+ public virtual bool IsAuthenticated => !m_name.Equals("");
}
}
diff --git a/SocketHttpListener/Net/HttpListenerContext.cs b/SocketHttpListener/Net/HttpListenerContext.cs
index 0bb31ef3e..8045299c6 100644
--- a/SocketHttpListener/Net/HttpListenerContext.cs
+++ b/SocketHttpListener/Net/HttpListenerContext.cs
@@ -18,13 +18,7 @@ namespace SocketHttpListener.Net
// This can be used to cache the results of HttpListener.AuthenticationSchemeSelectorDelegate.
internal AuthenticationSchemes AuthenticationSchemes { get; set; }
- public HttpListenerResponse Response
- {
- get
- {
- return _response;
- }
- }
+ public HttpListenerResponse Response => _response;
public Task<HttpListenerWebSocketContext> AcceptWebSocketAsync(string subProtocol)
{
@@ -62,13 +56,7 @@ namespace SocketHttpListener.Net
}
}
- public virtual IIdentity Identity
- {
- get
- {
- return m_identity;
- }
- }
+ public virtual IIdentity Identity => m_identity;
public virtual bool IsInRole(string role)
{
diff --git a/SocketHttpListener/Net/HttpListenerPrefixCollection.cs b/SocketHttpListener/Net/HttpListenerPrefixCollection.cs
index f0e496a5a..97dc6797c 100644
--- a/SocketHttpListener/Net/HttpListenerPrefixCollection.cs
+++ b/SocketHttpListener/Net/HttpListenerPrefixCollection.cs
@@ -18,20 +18,11 @@ namespace SocketHttpListener.Net
this.listener = listener;
}
- public int Count
- {
- get { return prefixes.Count; }
- }
+ public int Count => prefixes.Count;
- public bool IsReadOnly
- {
- get { return false; }
- }
+ public bool IsReadOnly => false;
- public bool IsSynchronized
- {
- get { return false; }
- }
+ public bool IsSynchronized => false;
public void Add(string uriPrefix)
{
diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
index 9097a85f5..198cdcf76 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
@@ -38,7 +38,7 @@ namespace SocketHttpListener.Net
public Version ProtocolVersion
{
- get { return _version; }
+ get => _version;
set
{
CheckDisposed();
@@ -57,7 +57,7 @@ namespace SocketHttpListener.Net
public int StatusCode
{
- get { return _statusCode; }
+ get => _statusCode;
set
{
CheckDisposed();
diff --git a/SocketHttpListener/Net/HttpListenerResponse.cs b/SocketHttpListener/Net/HttpListenerResponse.cs
index f9455db72..a32aca043 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.cs
@@ -15,16 +15,13 @@ namespace SocketHttpListener.Net
private string _statusDescription;
private WebHeaderCollection _webHeaders = new WebHeaderCollection();
- public WebHeaderCollection Headers
- {
- get { return _webHeaders; }
- }
+ public WebHeaderCollection Headers => _webHeaders;
public Encoding ContentEncoding { get; set; }
public string ContentType
{
- get { return Headers["Content-Type"]; }
+ get => Headers["Content-Type"];
set
{
CheckDisposed();
@@ -39,13 +36,13 @@ namespace SocketHttpListener.Net
}
}
- private HttpListenerContext HttpListenerContext { get { return _httpContext; } }
+ private HttpListenerContext HttpListenerContext => _httpContext;
- private HttpListenerRequest HttpListenerRequest { get { return HttpListenerContext.Request; } }
+ private HttpListenerRequest HttpListenerRequest => HttpListenerContext.Request;
internal EntitySendFormat EntitySendFormat
{
- get { return (EntitySendFormat)_boundaryType; }
+ get => (EntitySendFormat)_boundaryType;
set
{
CheckDisposed();
@@ -64,8 +61,8 @@ namespace SocketHttpListener.Net
public bool SendChunked
{
- get { return EntitySendFormat == EntitySendFormat.Chunked; }
- set { EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength; }
+ get => EntitySendFormat == EntitySendFormat.Chunked;
+ set => EntitySendFormat = value ? EntitySendFormat.Chunked : EntitySendFormat.ContentLength;
}
// We MUST NOT send message-body when we send responses with these Status codes
@@ -85,7 +82,7 @@ namespace SocketHttpListener.Net
public long ContentLength64
{
- get { return _contentLength; }
+ get => _contentLength;
set
{
CheckDisposed();
@@ -104,13 +101,13 @@ namespace SocketHttpListener.Net
public CookieCollection Cookies
{
- get { return _cookies ?? (_cookies = new CookieCollection()); }
- set { _cookies = value; }
+ get => _cookies ?? (_cookies = new CookieCollection());
+ set => _cookies = value;
}
public bool KeepAlive
{
- get { return _keepAlive; }
+ get => _keepAlive;
set
{
CheckDisposed();
@@ -130,7 +127,7 @@ namespace SocketHttpListener.Net
public string RedirectLocation
{
- get { return Headers["Location"]; }
+ get => Headers["Location"];
set
{
// note that this doesn't set the status code to a redirect one
diff --git a/SocketHttpListener/Net/HttpRequestStream.cs b/SocketHttpListener/Net/HttpRequestStream.cs
index ec3ca8d33..1c554df20 100644
--- a/SocketHttpListener/Net/HttpRequestStream.cs
+++ b/SocketHttpListener/Net/HttpRequestStream.cs
@@ -84,25 +84,13 @@ namespace SocketHttpListener.Net
public override void Flush() { }
public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
- public override long Length
- {
- get
- {
- throw new NotImplementedException();
- }
- }
+ public override long Length => throw new NotImplementedException();
public override long Position
{
- get
- {
- throw new NotImplementedException();
- }
+ get => throw new NotImplementedException();
- set
- {
- throw new NotImplementedException();
- }
+ set => throw new NotImplementedException();
}
public override long Seek(long offset, SeekOrigin origin)
diff --git a/SocketHttpListener/Net/HttpResponseStream.cs b/SocketHttpListener/Net/HttpResponseStream.cs
index bfe0199de..085c2ad0c 100644
--- a/SocketHttpListener/Net/HttpResponseStream.cs
+++ b/SocketHttpListener/Net/HttpResponseStream.cs
@@ -17,25 +17,13 @@ namespace SocketHttpListener.Net
public override void Flush() { }
public override Task FlushAsync(CancellationToken cancellationToken) => Task.CompletedTask;
- public override long Length
- {
- get
- {
- throw new NotImplementedException();
- }
- }
+ public override long Length => throw new NotImplementedException();
public override long Position
{
- get
- {
- throw new NotImplementedException();
- }
+ get => throw new NotImplementedException();
- set
- {
- throw new NotImplementedException();
- }
+ set => throw new NotImplementedException();
}
public override long Seek(long offset, SeekOrigin origin)
diff --git a/SocketHttpListener/Net/HttpStreamAsyncResult.cs b/SocketHttpListener/Net/HttpStreamAsyncResult.cs
index d96988fce..46944c624 100644
--- a/SocketHttpListener/Net/HttpStreamAsyncResult.cs
+++ b/SocketHttpListener/Net/HttpStreamAsyncResult.cs
@@ -47,10 +47,7 @@ namespace SocketHttpListener.Net
}
}
- public object AsyncState
- {
- get { return _state; }
- }
+ public object AsyncState => _state;
public WaitHandle AsyncWaitHandle
{
diff --git a/SocketHttpListener/Net/ListenerPrefix.cs b/SocketHttpListener/Net/ListenerPrefix.cs
index b29cc5c6d..3e78752fd 100644
--- a/SocketHttpListener/Net/ListenerPrefix.cs
+++ b/SocketHttpListener/Net/ListenerPrefix.cs
@@ -26,28 +26,16 @@ namespace SocketHttpListener.Net
public IPAddress[] Addresses
{
- get { return _addresses; }
- set { _addresses = value; }
- }
- public bool Secure
- {
- get { return _secure; }
+ get => _addresses;
+ set => _addresses = value;
}
+ public bool Secure => _secure;
- public string Host
- {
- get { return _host; }
- }
+ public string Host => _host;
- public int Port
- {
- get { return _port; }
- }
+ public int Port => _port;
- public string Path
- {
- get { return _path; }
- }
+ public string Path => _path;
// Equals and GetHashCode are required to detect duplicates in HttpListenerPrefixCollection.
public override bool Equals(object o)
diff --git a/SocketHttpListener/PayloadData.cs b/SocketHttpListener/PayloadData.cs
index 829db6304..6d15a6bcb 100644
--- a/SocketHttpListener/PayloadData.cs
+++ b/SocketHttpListener/PayloadData.cs
@@ -54,50 +54,21 @@ namespace SocketHttpListener
#region Internal Properties
- internal bool ContainsReservedCloseStatusCode
- {
- get
- {
- return _applicationData.Length > 1 &&
- _applicationData.SubArray(0, 2).ToUInt16(ByteOrder.Big).IsReserved();
- }
- }
+ internal bool ContainsReservedCloseStatusCode =>
+ _applicationData.Length > 1 &&
+ _applicationData.SubArray(0, 2).ToUInt16(ByteOrder.Big).IsReserved();
#endregion
#region Public Properties
- public byte[] ApplicationData
- {
- get
- {
- return _applicationData;
- }
- }
+ public byte[] ApplicationData => _applicationData;
- public byte[] ExtensionData
- {
- get
- {
- return _extensionData;
- }
- }
+ public byte[] ExtensionData => _extensionData;
- public bool IsMasked
- {
- get
- {
- return _masked;
- }
- }
+ public bool IsMasked => _masked;
- public ulong Length
- {
- get
- {
- return (ulong)(_extensionData.Length + _applicationData.Length);
- }
- }
+ public ulong Length => (ulong)(_extensionData.Length + _applicationData.Length);
#endregion
diff --git a/SocketHttpListener/SocketStream.cs b/SocketHttpListener/SocketStream.cs
index 6631bb267..f51fde97e 100644
--- a/SocketHttpListener/SocketStream.cs
+++ b/SocketHttpListener/SocketStream.cs
@@ -17,26 +17,18 @@ namespace SocketHttpListener
{
}
- public override bool CanRead
- {
- get { return true; }
- }
- public override bool CanSeek
- {
- get { return false; }
- }
- public override bool CanWrite
- {
- get { return true; }
- }
- public override long Length
- {
- get { throw new NotImplementedException(); }
- }
+ public override bool CanRead => true;
+
+ public override bool CanSeek => false;
+
+ public override bool CanWrite => true;
+
+ public override long Length => throw new NotImplementedException();
+
public override long Position
{
- get { throw new NotImplementedException(); }
- set { throw new NotImplementedException(); }
+ get => throw new NotImplementedException();
+ set => throw new NotImplementedException();
}
public override void Write(byte[] buffer, int offset, int count)
diff --git a/SocketHttpListener/WebSocket.cs b/SocketHttpListener/WebSocket.cs
index 98b9c776d..e5b3f89bc 100644
--- a/SocketHttpListener/WebSocket.cs
+++ b/SocketHttpListener/WebSocket.cs
@@ -78,11 +78,7 @@ namespace SocketHttpListener
init();
}
- public static TimeSpan DefaultKeepAliveInterval
- {
- // In the .NET Framework, this pulls the value from a P/Invoke. Here we just hardcode it to a reasonable default.
- get { return TimeSpan.FromSeconds(30); }
- }
+ public static TimeSpan DefaultKeepAliveInterval => TimeSpan.FromSeconds(30);
#endregion
@@ -93,13 +89,7 @@ namespace SocketHttpListener
/// One of the <see cref="WebSocketState"/> enum values, indicates the state of the WebSocket
/// connection. The default value is <see cref="WebSocketState.Connecting"/>.
/// </value>
- public WebSocketState ReadyState
- {
- get
- {
- return _readyState;
- }
- }
+ public WebSocketState ReadyState => _readyState;
#region Public Events
diff --git a/SocketHttpListener/WebSocketFrame.cs b/SocketHttpListener/WebSocketFrame.cs
index c695c605c..74ed23c45 100644
--- a/SocketHttpListener/WebSocketFrame.cs
+++ b/SocketHttpListener/WebSocketFrame.cs
@@ -106,197 +106,53 @@ namespace SocketHttpListener
#region Public Properties
- public byte[] ExtendedPayloadLength
- {
- get
- {
- return _extPayloadLength;
- }
- }
+ public byte[] ExtendedPayloadLength => _extPayloadLength;
- public Fin Fin
- {
- get
- {
- return _fin;
- }
- }
+ public Fin Fin => _fin;
- public bool IsBinary
- {
- get
- {
- return _opcode == Opcode.Binary;
- }
- }
+ public bool IsBinary => _opcode == Opcode.Binary;
- public bool IsClose
- {
- get
- {
- return _opcode == Opcode.Close;
- }
- }
+ public bool IsClose => _opcode == Opcode.Close;
- public bool IsCompressed
- {
- get
- {
- return _rsv1 == Rsv.On;
- }
- }
+ public bool IsCompressed => _rsv1 == Rsv.On;
- public bool IsContinuation
- {
- get
- {
- return _opcode == Opcode.Cont;
- }
- }
+ public bool IsContinuation => _opcode == Opcode.Cont;
- public bool IsControl
- {
- get
- {
- return _opcode == Opcode.Close || _opcode == Opcode.Ping || _opcode == Opcode.Pong;
- }
- }
+ public bool IsControl => _opcode == Opcode.Close || _opcode == Opcode.Ping || _opcode == Opcode.Pong;
- public bool IsData
- {
- get
- {
- return _opcode == Opcode.Binary || _opcode == Opcode.Text;
- }
- }
+ public bool IsData => _opcode == Opcode.Binary || _opcode == Opcode.Text;
- public bool IsFinal
- {
- get
- {
- return _fin == Fin.Final;
- }
- }
+ public bool IsFinal => _fin == Fin.Final;
- public bool IsFragmented
- {
- get
- {
- return _fin == Fin.More || _opcode == Opcode.Cont;
- }
- }
+ public bool IsFragmented => _fin == Fin.More || _opcode == Opcode.Cont;
- public bool IsMasked
- {
- get
- {
- return _mask == Mask.Mask;
- }
- }
+ public bool IsMasked => _mask == Mask.Mask;
- public bool IsPerMessageCompressed
- {
- get
- {
- return (_opcode == Opcode.Binary || _opcode == Opcode.Text) && _rsv1 == Rsv.On;
- }
- }
+ public bool IsPerMessageCompressed => (_opcode == Opcode.Binary || _opcode == Opcode.Text) && _rsv1 == Rsv.On;
- public bool IsPing
- {
- get
- {
- return _opcode == Opcode.Ping;
- }
- }
+ public bool IsPing => _opcode == Opcode.Ping;
- public bool IsPong
- {
- get
- {
- return _opcode == Opcode.Pong;
- }
- }
+ public bool IsPong => _opcode == Opcode.Pong;
- public bool IsText
- {
- get
- {
- return _opcode == Opcode.Text;
- }
- }
+ public bool IsText => _opcode == Opcode.Text;
- public ulong Length
- {
- get
- {
- return 2 + (ulong)(_extPayloadLength.Length + _maskingKey.Length) + _payloadData.Length;
- }
- }
+ public ulong Length => 2 + (ulong)(_extPayloadLength.Length + _maskingKey.Length) + _payloadData.Length;
- public Mask Mask
- {
- get
- {
- return _mask;
- }
- }
+ public Mask Mask => _mask;
- public byte[] MaskingKey
- {
- get
- {
- return _maskingKey;
- }
- }
+ public byte[] MaskingKey => _maskingKey;
- public Opcode Opcode
- {
- get
- {
- return _opcode;
- }
- }
+ public Opcode Opcode => _opcode;
- public PayloadData PayloadData
- {
- get
- {
- return _payloadData;
- }
- }
+ public PayloadData PayloadData => _payloadData;
- public byte PayloadLength
- {
- get
- {
- return _payloadLength;
- }
- }
+ public byte PayloadLength => _payloadLength;
- public Rsv Rsv1
- {
- get
- {
- return _rsv1;
- }
- }
+ public Rsv Rsv1 => _rsv1;
- public Rsv Rsv2
- {
- get
- {
- return _rsv2;
- }
- }
+ public Rsv Rsv2 => _rsv2;
- public Rsv Rsv3
- {
- get
- {
- return _rsv3;
- }
- }
+ public Rsv Rsv3 => _rsv3;
#endregion