Fix a few for HttpListenerResponse.cs
This commit is contained in:
parent
6a063c64d4
commit
0b8349869d
@ -122,7 +122,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public Encoding ContentEncoding {
|
public Encoding ContentEncoding {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _contentEncoding;
|
return _contentEncoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public long ContentLength64 {
|
public long ContentLength64 {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _contentLength;
|
return _contentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public string ContentType {
|
public string ContentType {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _contentType;
|
return _contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public CookieCollection Cookies {
|
public CookieCollection Cookies {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _cookies ?? (_cookies = new CookieCollection ());
|
return _cookies ?? (_cookies = new CookieCollection ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,6 +231,9 @@ namespace WebSocketSharp.Net
|
|||||||
/// <value>
|
/// <value>
|
||||||
/// A <see cref="WebHeaderCollection"/> that contains the headers returned to the client.
|
/// A <see cref="WebHeaderCollection"/> that contains the headers returned to the client.
|
||||||
/// </value>
|
/// </value>
|
||||||
|
/// <exception cref="ArgumentNullException">
|
||||||
|
/// The value specified for a set operation is <see langword="null"/>.
|
||||||
|
/// </exception>
|
||||||
/// <exception cref="InvalidOperationException">
|
/// <exception cref="InvalidOperationException">
|
||||||
/// The response has already been sent.
|
/// The response has already been sent.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
@ -254,6 +257,9 @@ namespace WebSocketSharp.Net
|
|||||||
// TODO: Check if this is marked readonly after headers are sent.
|
// TODO: Check if this is marked readonly after headers are sent.
|
||||||
|
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposedOrHeadersSent ();
|
||||||
|
if (value == null)
|
||||||
|
throw new ArgumentNullException ("value");
|
||||||
|
|
||||||
_headers = value;
|
_headers = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,7 +279,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public bool KeepAlive {
|
public bool KeepAlive {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _keepAlive;
|
return _keepAlive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,9 +300,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public Stream OutputStream {
|
public Stream OutputStream {
|
||||||
get {
|
get {
|
||||||
if (_disposed)
|
checkDisposed ();
|
||||||
throw new ObjectDisposedException (GetType ().ToString ());
|
|
||||||
|
|
||||||
return _outputStream ?? (_outputStream = _context.Connection.GetResponseStream ());
|
return _outputStream ?? (_outputStream = _context.Connection.GetResponseStream ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +326,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public Version ProtocolVersion {
|
public Version ProtocolVersion {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _version;
|
return _version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +359,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public string RedirectLocation {
|
public string RedirectLocation {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _location;
|
return _location;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +413,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public int StatusCode {
|
public int StatusCode {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _statusCode;
|
return _statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +442,7 @@ namespace WebSocketSharp.Net
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public string StatusDescription {
|
public string StatusDescription {
|
||||||
get {
|
get {
|
||||||
checkDisposedOrHeadersSent ();
|
checkDisposed ();
|
||||||
return _statusDescription;
|
return _statusDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,20 +460,27 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
private bool canAddOrUpdate (Cookie cookie)
|
private bool canAddOrUpdate (Cookie cookie)
|
||||||
{
|
{
|
||||||
if (Cookies.Count == 0)
|
if (_cookies == null || _cookies.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var found = findCookie (cookie).ToList ();
|
var found = findCookie (cookie).ToList ();
|
||||||
if (found.Count == 0)
|
if (found.Count == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
var version = cookie.Version;
|
||||||
foreach (var c in found)
|
foreach (var c in found)
|
||||||
if (c.Version == cookie.Version)
|
if (c.Version == version)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkDisposed ()
|
||||||
|
{
|
||||||
|
if (_disposed)
|
||||||
|
throw new ObjectDisposedException (GetType ().ToString ());
|
||||||
|
}
|
||||||
|
|
||||||
private void checkDisposedOrHeadersSent ()
|
private void checkDisposedOrHeadersSent ()
|
||||||
{
|
{
|
||||||
if (_disposed)
|
if (_disposed)
|
||||||
@ -490,8 +501,8 @@ namespace WebSocketSharp.Net
|
|||||||
var name = cookie.Name;
|
var name = cookie.Name;
|
||||||
var domain = cookie.Domain;
|
var domain = cookie.Domain;
|
||||||
var path = cookie.Path;
|
var path = cookie.Path;
|
||||||
|
if (_cookies != null)
|
||||||
foreach (Cookie c in Cookies)
|
foreach (Cookie c in _cookies)
|
||||||
if (c.Name.Equals (name, StringComparison.OrdinalIgnoreCase) &&
|
if (c.Name.Equals (name, StringComparison.OrdinalIgnoreCase) &&
|
||||||
c.Domain.Equals (domain, StringComparison.OrdinalIgnoreCase) &&
|
c.Domain.Equals (domain, StringComparison.OrdinalIgnoreCase) &&
|
||||||
c.Path.Equals (path, StringComparison.Ordinal))
|
c.Path.Equals (path, StringComparison.Ordinal))
|
||||||
|
Loading…
Reference in New Issue
Block a user