Refactored Ext.cs
This commit is contained in:
parent
69c9be3eb5
commit
ab2ef30f02
File diff suppressed because it is too large
Load Diff
@ -37,8 +37,8 @@ using System.Text;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace WebSocketSharp.Net {
|
namespace WebSocketSharp.Net
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a set of properties and methods used to manage an HTTP Cookie.
|
/// Provides a set of properties and methods used to manage an HTTP Cookie.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,8 +54,8 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public sealed class Cookie {
|
public sealed class Cookie
|
||||||
|
{
|
||||||
#region Static Private Fields
|
#region Static Private Fields
|
||||||
|
|
||||||
static char [] reservedCharsForName = new char [] {' ', '=', ';', ',', '\n', '\r', '\t'};
|
static char [] reservedCharsForName = new char [] {' ', '=', ';', ',', '\n', '\r', '\t'};
|
||||||
@ -270,7 +270,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </value>
|
/// </value>
|
||||||
public string Comment {
|
public string Comment {
|
||||||
get { return comment; }
|
get { return comment; }
|
||||||
set { comment = value.IsNull () ? String.Empty : value; }
|
set { comment = value ?? String.Empty; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -395,7 +395,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </value>
|
/// </value>
|
||||||
public string Path {
|
public string Path {
|
||||||
get { return path; }
|
get { return path; }
|
||||||
set { path = value.IsNull () ? String.Empty : value; }
|
set { path = value ?? String.Empty; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -480,9 +480,7 @@ namespace WebSocketSharp.Net {
|
|||||||
if (!CanSetValue (value, out msg))
|
if (!CanSetValue (value, out msg))
|
||||||
throw new CookieException (msg);
|
throw new CookieException (msg);
|
||||||
|
|
||||||
val = value.IsEmpty ()
|
val = value.Length == 0 ? "\"\"" : value;
|
||||||
? "\"\""
|
|
||||||
: value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +526,7 @@ namespace WebSocketSharp.Net {
|
|||||||
|
|
||||||
static bool CanSetValue (string value, out string message)
|
static bool CanSetValue (string value, out string message)
|
||||||
{
|
{
|
||||||
if (value.IsNull ()) {
|
if (value == null) {
|
||||||
message = "Value must not be null.";
|
message = "Value must not be null.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -595,7 +593,7 @@ namespace WebSocketSharp.Net {
|
|||||||
if (!comment.IsNullOrEmpty ())
|
if (!comment.IsNullOrEmpty ())
|
||||||
result.AppendFormat ("; Comment={0}", comment.UrlEncode ());
|
result.AppendFormat ("; Comment={0}", comment.UrlEncode ());
|
||||||
|
|
||||||
if (!commentUri.IsNull ())
|
if (commentUri != null)
|
||||||
result.AppendFormat ("; CommentURL={0}", commentUri.OriginalString.Quote ());
|
result.AppendFormat ("; CommentURL={0}", commentUri.OriginalString.Quote ());
|
||||||
|
|
||||||
if (discard)
|
if (discard)
|
||||||
@ -614,7 +612,7 @@ namespace WebSocketSharp.Net {
|
|||||||
for (int i = 0; i < values.Length; i++) {
|
for (int i = 0; i < values.Length; i++) {
|
||||||
tmp [i] = int.MinValue;
|
tmp [i] = int.MinValue;
|
||||||
var v = values [i].Trim ();
|
var v = values [i].Trim ();
|
||||||
if (v.IsEmpty ())
|
if (v.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!int.TryParse (v, out tmp [i])) {
|
if (!int.TryParse (v, out tmp [i])) {
|
||||||
@ -636,7 +634,7 @@ namespace WebSocketSharp.Net {
|
|||||||
// From client to server
|
// From client to server
|
||||||
internal string ToRequestString (Uri uri)
|
internal string ToRequestString (Uri uri)
|
||||||
{
|
{
|
||||||
if (name.IsEmpty ())
|
if (name.Length == 0)
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
|
||||||
if (version == 0)
|
if (version == 0)
|
||||||
@ -646,12 +644,12 @@ namespace WebSocketSharp.Net {
|
|||||||
result.AppendFormat ("$Version={0}; {1}={2}", version, name, val);
|
result.AppendFormat ("$Version={0}; {1}={2}", version, name, val);
|
||||||
if (!path.IsNullOrEmpty ())
|
if (!path.IsNullOrEmpty ())
|
||||||
result.AppendFormat ("; $Path={0}", path);
|
result.AppendFormat ("; $Path={0}", path);
|
||||||
else if (!uri.IsNull ())
|
else if (uri != null)
|
||||||
result.AppendFormat ("; $Path={0}", uri.GetAbsolutePath ());
|
result.AppendFormat ("; $Path={0}", uri.GetAbsolutePath ());
|
||||||
else
|
else
|
||||||
result.Append ("; $Path=/");
|
result.Append ("; $Path=/");
|
||||||
|
|
||||||
bool append_domain = uri.IsNull () || uri.Host != domain;
|
bool append_domain = uri == null || uri.Host != domain;
|
||||||
if (append_domain && !domain.IsNullOrEmpty ())
|
if (append_domain && !domain.IsNullOrEmpty ())
|
||||||
result.AppendFormat ("; $Domain={0}", domain);
|
result.AppendFormat ("; $Domain={0}", domain);
|
||||||
|
|
||||||
@ -667,7 +665,7 @@ namespace WebSocketSharp.Net {
|
|||||||
// From server to client
|
// From server to client
|
||||||
internal string ToResponseString ()
|
internal string ToResponseString ()
|
||||||
{
|
{
|
||||||
return name.IsEmpty ()
|
return name.Length == 0
|
||||||
? String.Empty
|
? String.Empty
|
||||||
: version == 0
|
: version == 0
|
||||||
? ToResponseStringVersion0 ()
|
? ToResponseStringVersion0 ()
|
||||||
@ -691,7 +689,7 @@ namespace WebSocketSharp.Net {
|
|||||||
public override bool Equals (Object comparand)
|
public override bool Equals (Object comparand)
|
||||||
{
|
{
|
||||||
var cookie = comparand as Cookie;
|
var cookie = comparand as Cookie;
|
||||||
return !cookie.IsNull() &&
|
return cookie != null &&
|
||||||
name.Equals (cookie.Name, StringComparison.InvariantCultureIgnoreCase) &&
|
name.Equals (cookie.Name, StringComparison.InvariantCultureIgnoreCase) &&
|
||||||
val.Equals (cookie.Value, StringComparison.InvariantCulture) &&
|
val.Equals (cookie.Value, StringComparison.InvariantCulture) &&
|
||||||
path.Equals (cookie.Path, StringComparison.InvariantCulture) &&
|
path.Equals (cookie.Path, StringComparison.InvariantCulture) &&
|
||||||
|
@ -179,7 +179,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public Cookie this [string name] {
|
public Cookie this [string name] {
|
||||||
get {
|
get {
|
||||||
if (name.IsNull ())
|
if (name == null)
|
||||||
throw new ArgumentNullException ("name");
|
throw new ArgumentNullException ("name");
|
||||||
|
|
||||||
foreach (var cookie in Sorted) {
|
foreach (var cookie in Sorted) {
|
||||||
@ -199,7 +199,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </value>
|
/// </value>
|
||||||
public Object SyncRoot {
|
public Object SyncRoot {
|
||||||
get {
|
get {
|
||||||
if (sync.IsNull ())
|
if (sync == null)
|
||||||
sync = new object ();
|
sync = new object ();
|
||||||
|
|
||||||
return sync;
|
return sync;
|
||||||
@ -219,18 +219,18 @@ namespace WebSocketSharp.Net {
|
|||||||
string [] pairs = Split(value).ToArray();
|
string [] pairs = Split(value).ToArray();
|
||||||
for (int i = 0; i < pairs.Length; i++) {
|
for (int i = 0; i < pairs.Length; i++) {
|
||||||
string pair = pairs [i].Trim ();
|
string pair = pairs [i].Trim ();
|
||||||
if (pair.IsEmpty ())
|
if (pair.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pair.StartsWith ("$version", StringComparison.InvariantCultureIgnoreCase)) {
|
if (pair.StartsWith ("$version", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
version = Int32.Parse (pair.GetValueInternal ("=").Trim ('"'));
|
version = Int32.Parse (pair.GetValueInternal ("=").Trim ('"'));
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("$path", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("$path", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Path = pair.GetValueInternal ("=");
|
cookie.Path = pair.GetValueInternal ("=");
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("$domain", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("$domain", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Domain = pair.GetValueInternal ("=");
|
cookie.Domain = pair.GetValueInternal ("=");
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("$port", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("$port", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
@ -238,11 +238,11 @@ namespace WebSocketSharp.Net {
|
|||||||
? "\"\""
|
? "\"\""
|
||||||
: pair.GetValueInternal ("=");
|
: pair.GetValueInternal ("=");
|
||||||
|
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Port = port;
|
cookie.Port = port;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookies.Add (cookie);
|
cookies.Add (cookie);
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
@ -265,7 +265,7 @@ namespace WebSocketSharp.Net {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookies.Add (cookie);
|
cookies.Add (cookie);
|
||||||
|
|
||||||
return cookies;
|
return cookies;
|
||||||
@ -279,11 +279,11 @@ namespace WebSocketSharp.Net {
|
|||||||
string [] pairs = Split(value).ToArray();
|
string [] pairs = Split(value).ToArray();
|
||||||
for (int i = 0; i < pairs.Length; i++) {
|
for (int i = 0; i < pairs.Length; i++) {
|
||||||
string pair = pairs [i].Trim ();
|
string pair = pairs [i].Trim ();
|
||||||
if (pair.IsEmpty ())
|
if (pair.Length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pair.StartsWith ("version", StringComparison.InvariantCultureIgnoreCase)) {
|
if (pair.StartsWith ("version", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Version = Int32.Parse (pair.GetValueInternal ("=").Trim ('"'));
|
cookie.Version = Int32.Parse (pair.GetValueInternal ("=").Trim ('"'));
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("expires", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("expires", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
@ -299,21 +299,21 @@ namespace WebSocketSharp.Net {
|
|||||||
out expires))
|
out expires))
|
||||||
expires = DateTime.Now;
|
expires = DateTime.Now;
|
||||||
|
|
||||||
if (!cookie.IsNull () && cookie.Expires == DateTime.MinValue)
|
if (cookie != null && cookie.Expires == DateTime.MinValue)
|
||||||
cookie.Expires = expires.ToLocalTime ();
|
cookie.Expires = expires.ToLocalTime ();
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("max-age", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("max-age", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
int max = Int32.Parse (pair.GetValueInternal ("=").Trim ('"'));
|
int max = Int32.Parse (pair.GetValueInternal ("=").Trim ('"'));
|
||||||
var expires = DateTime.Now.AddSeconds ((double) max);
|
var expires = DateTime.Now.AddSeconds ((double) max);
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Expires = expires;
|
cookie.Expires = expires;
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("path", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("path", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Path = pair.GetValueInternal ("=");
|
cookie.Path = pair.GetValueInternal ("=");
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("domain", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("domain", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Domain = pair.GetValueInternal ("=");
|
cookie.Domain = pair.GetValueInternal ("=");
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("port", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("port", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
@ -321,31 +321,31 @@ namespace WebSocketSharp.Net {
|
|||||||
? "\"\""
|
? "\"\""
|
||||||
: pair.GetValueInternal ("=");
|
: pair.GetValueInternal ("=");
|
||||||
|
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Port = port;
|
cookie.Port = port;
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("comment", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("comment", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Comment = pair.GetValueInternal ("=").UrlDecode ();
|
cookie.Comment = pair.GetValueInternal ("=").UrlDecode ();
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("commenturl", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("commenturl", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.CommentUri = pair.GetValueInternal ("=").Trim ('"').ToUri ();
|
cookie.CommentUri = pair.GetValueInternal ("=").Trim ('"').ToUri ();
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("discard", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("discard", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Discard = true;
|
cookie.Discard = true;
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("secure", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("secure", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.Secure = true;
|
cookie.Secure = true;
|
||||||
}
|
}
|
||||||
else if (pair.StartsWith ("httponly", StringComparison.InvariantCultureIgnoreCase)) {
|
else if (pair.StartsWith ("httponly", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookie.HttpOnly = true;
|
cookie.HttpOnly = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookies.Add (cookie);
|
cookies.Add (cookie);
|
||||||
|
|
||||||
string name;
|
string name;
|
||||||
@ -366,7 +366,7 @@ namespace WebSocketSharp.Net {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cookie.IsNull ())
|
if (cookie != null)
|
||||||
cookies.Add (cookie);
|
cookies.Add (cookie);
|
||||||
|
|
||||||
return cookies;
|
return cookies;
|
||||||
@ -457,7 +457,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void Add (Cookie cookie)
|
public void Add (Cookie cookie)
|
||||||
{
|
{
|
||||||
if (cookie.IsNull ())
|
if (cookie == null)
|
||||||
throw new ArgumentNullException ("cookie");
|
throw new ArgumentNullException ("cookie");
|
||||||
|
|
||||||
int pos = SearchCookie (cookie);
|
int pos = SearchCookie (cookie);
|
||||||
@ -478,7 +478,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void Add (CookieCollection cookies)
|
public void Add (CookieCollection cookies)
|
||||||
{
|
{
|
||||||
if (cookies.IsNull ())
|
if (cookies == null)
|
||||||
throw new ArgumentNullException ("cookies");
|
throw new ArgumentNullException ("cookies");
|
||||||
|
|
||||||
foreach (Cookie cookie in cookies)
|
foreach (Cookie cookie in cookies)
|
||||||
@ -519,7 +519,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void CopyTo (Array array, int index)
|
public void CopyTo (Array array, int index)
|
||||||
{
|
{
|
||||||
if (array.IsNull ())
|
if (array == null)
|
||||||
throw new ArgumentNullException ("array");
|
throw new ArgumentNullException ("array");
|
||||||
|
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
@ -561,7 +561,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void CopyTo (Cookie [] array, int index)
|
public void CopyTo (Cookie [] array, int index)
|
||||||
{
|
{
|
||||||
if (array.IsNull ())
|
if (array == null)
|
||||||
throw new ArgumentNullException ("array");
|
throw new ArgumentNullException ("array");
|
||||||
|
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
|
@ -36,8 +36,8 @@ using System.Linq;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace WebSocketSharp.Net {
|
namespace WebSocketSharp.Net
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides access to a response to a request being processed by a <see cref="HttpListener"/> instance.
|
/// Provides access to a response to a request being processed by a <see cref="HttpListener"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -184,10 +184,10 @@ namespace WebSocketSharp.Net {
|
|||||||
if (HeadersSent)
|
if (HeadersSent)
|
||||||
throw new InvalidOperationException ("Cannot be changed after headers are sent.");
|
throw new InvalidOperationException ("Cannot be changed after headers are sent.");
|
||||||
|
|
||||||
if (value.IsNull ())
|
if (value == null)
|
||||||
throw new ArgumentNullException ("value");
|
throw new ArgumentNullException ("value");
|
||||||
|
|
||||||
if (value.IsEmpty ())
|
if (value.Length == 0)
|
||||||
throw new ArgumentException ("Must not be empty.", "value");
|
throw new ArgumentException ("Must not be empty.", "value");
|
||||||
|
|
||||||
content_type = value;
|
content_type = value;
|
||||||
@ -342,7 +342,7 @@ namespace WebSocketSharp.Net {
|
|||||||
if (HeadersSent)
|
if (HeadersSent)
|
||||||
throw new InvalidOperationException ("Cannot be changed after headers are sent.");
|
throw new InvalidOperationException ("Cannot be changed after headers are sent.");
|
||||||
|
|
||||||
if (value.IsEmpty ())
|
if (value.Length == 0)
|
||||||
throw new ArgumentException ("Must not be empty.", "value");
|
throw new ArgumentException ("Must not be empty.", "value");
|
||||||
|
|
||||||
location = value;
|
location = value;
|
||||||
@ -758,7 +758,7 @@ namespace WebSocketSharp.Net {
|
|||||||
/// </exception>
|
/// </exception>
|
||||||
public void SetCookie (Cookie cookie)
|
public void SetCookie (Cookie cookie)
|
||||||
{
|
{
|
||||||
if (cookie.IsNull())
|
if (cookie == null)
|
||||||
throw new ArgumentNullException ("cookie");
|
throw new ArgumentNullException ("cookie");
|
||||||
|
|
||||||
if (!CanAddOrUpdate (cookie))
|
if (!CanAddOrUpdate (cookie))
|
||||||
|
@ -43,15 +43,15 @@ using System.Runtime.Serialization;
|
|||||||
using System.Security.Permissions;
|
using System.Security.Permissions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace WebSocketSharp.Net {
|
namespace WebSocketSharp.Net
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a collection of the HTTP headers associated with a request or response.
|
/// Provides a collection of the HTTP headers associated with a request or response.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
[ComVisible (true)]
|
[ComVisible (true)]
|
||||||
public class WebHeaderCollection : NameValueCollection, ISerializable {
|
public class WebHeaderCollection : NameValueCollection, ISerializable
|
||||||
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
static readonly Dictionary<string, HttpHeaderInfo> headers;
|
static readonly Dictionary<string, HttpHeaderInfo> headers;
|
||||||
@ -275,7 +275,7 @@ namespace WebSocketSharp.Net {
|
|||||||
protected WebHeaderCollection (
|
protected WebHeaderCollection (
|
||||||
SerializationInfo serializationInfo, StreamingContext streamingContext)
|
SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||||
{
|
{
|
||||||
if (serializationInfo.IsNull ())
|
if (serializationInfo == null)
|
||||||
throw new ArgumentNullException ("serializationInfo");
|
throw new ArgumentNullException ("serializationInfo");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -582,9 +582,7 @@ namespace WebSocketSharp.Net {
|
|||||||
static bool TryGetHeaderInfo (string name, out HttpHeaderInfo info)
|
static bool TryGetHeaderInfo (string name, out HttpHeaderInfo info)
|
||||||
{
|
{
|
||||||
info = GetHeaderInfo (name);
|
info = GetHeaderInfo (name);
|
||||||
return info.IsNull ()
|
return info != null;
|
||||||
? false
|
|
||||||
: true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -932,7 +930,7 @@ namespace WebSocketSharp.Net {
|
|||||||
public override string [] GetValues (string header)
|
public override string [] GetValues (string header)
|
||||||
{
|
{
|
||||||
string [] values = base.GetValues (header);
|
string [] values = base.GetValues (header);
|
||||||
return values.IsNull () || values.Length == 0
|
return values == null || values.Length == 0
|
||||||
? null
|
? null
|
||||||
: values;
|
: values;
|
||||||
}
|
}
|
||||||
@ -949,7 +947,7 @@ namespace WebSocketSharp.Net {
|
|||||||
public override string [] GetValues (int index)
|
public override string [] GetValues (int index)
|
||||||
{
|
{
|
||||||
string [] values = base.GetValues (index);
|
string [] values = base.GetValues (index);
|
||||||
return values.IsNull () || values.Length == 0
|
return values == null || values.Length == 0
|
||||||
? null
|
? null
|
||||||
: values;
|
: values;
|
||||||
}
|
}
|
||||||
@ -971,7 +969,7 @@ namespace WebSocketSharp.Net {
|
|||||||
public override void GetObjectData (
|
public override void GetObjectData (
|
||||||
SerializationInfo serializationInfo, StreamingContext streamingContext)
|
SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||||
{
|
{
|
||||||
if (serializationInfo.IsNull ())
|
if (serializationInfo == null)
|
||||||
throw new ArgumentNullException ("serializationInfo");
|
throw new ArgumentNullException ("serializationInfo");
|
||||||
|
|
||||||
serializationInfo.AddValue ("InternallyCreated", internallyCreated);
|
serializationInfo.AddValue ("InternallyCreated", internallyCreated);
|
||||||
|
Loading…
Reference in New Issue
Block a user