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