Refactored HttpHeaderInfo.cs

This commit is contained in:
sta 2014-12-03 14:27:48 +09:00
parent 171df40d85
commit dbe97b4d00

View File

@ -34,16 +34,23 @@ namespace WebSocketSharp.Net
{ {
#region Private Fields #region Private Fields
private string _name;
private HttpHeaderType _type; private HttpHeaderType _type;
#endregion #endregion
#region Public Constructors #region Internal Constructors
public HttpHeaderInfo () internal HttpHeaderInfo ()
{ {
} }
internal HttpHeaderInfo (string name, HttpHeaderType type)
{
_name = name;
_type = type;
}
#endregion #endregion
#region Internal Properties #region Internal Properties
@ -77,7 +84,13 @@ namespace WebSocketSharp.Net
} }
public string Name { public string Name {
get; set; get {
return _name;
}
internal set {
_name = value;
}
} }
public HttpHeaderType Type { public HttpHeaderType Type {
@ -85,7 +98,7 @@ namespace WebSocketSharp.Net
return _type; return _type;
} }
set { internal set {
_type = value; _type = value;
} }
} }
@ -96,22 +109,16 @@ namespace WebSocketSharp.Net
public bool IsMultiValue (bool response) public bool IsMultiValue (bool response)
{ {
return (_type & HttpHeaderType.MultiValue) != HttpHeaderType.MultiValue return (_type & HttpHeaderType.MultiValue) == HttpHeaderType.MultiValue
? response ? (response ? IsResponse : IsRequest)
? IsMultiValueInResponse : (response ? IsMultiValueInResponse : IsMultiValueInRequest);
: IsMultiValueInRequest
: response
? IsResponse
: IsRequest;
} }
public bool IsRestricted (bool response) public bool IsRestricted (bool response)
{ {
return (_type & HttpHeaderType.Restricted) != HttpHeaderType.Restricted return (_type & HttpHeaderType.Restricted) == HttpHeaderType.Restricted
? false ? (response ? IsResponse : IsRequest)
: response : false;
? IsResponse
: IsRequest;
} }
#endregion #endregion