From 3b297e3d7d49cfff3d92826f36eb72cdbb8a99bd Mon Sep 17 00:00:00 2001 From: sta Date: Thu, 4 Dec 2014 15:51:22 +0900 Subject: [PATCH] Refactored WebHeaderCollection.cs --- websocket-sharp/Net/WebHeaderCollection.cs | 448 +++++++++------------ 1 file changed, 192 insertions(+), 256 deletions(-) diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index b48111f2..1c011535 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -75,439 +75,375 @@ namespace WebSocketSharp.Net new Dictionary (StringComparer.InvariantCultureIgnoreCase) { { "Accept", - new HttpHeaderInfo () { - Name = "Accept", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Accept", + HttpHeaderType.Request | HttpHeaderType.Restricted | HttpHeaderType.MultiValue) }, { "AcceptCharset", - new HttpHeaderInfo () { - Name = "Accept-Charset", - Type = HttpHeaderType.Request | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Accept-Charset", + HttpHeaderType.Request | HttpHeaderType.MultiValue) }, { "AcceptEncoding", - new HttpHeaderInfo () { - Name = "Accept-Encoding", - Type = HttpHeaderType.Request | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Accept-Encoding", + HttpHeaderType.Request | HttpHeaderType.MultiValue) }, { "AcceptLanguage", - new HttpHeaderInfo () { - Name = "Accept-language", - Type = HttpHeaderType.Request | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Accept-language", + HttpHeaderType.Request | HttpHeaderType.MultiValue) }, { "AcceptRanges", - new HttpHeaderInfo () { - Name = "Accept-Ranges", - Type = HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Accept-Ranges", + HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Age", - new HttpHeaderInfo () { - Name = "Age", - Type = HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Age", + HttpHeaderType.Response) }, { "Allow", - new HttpHeaderInfo () { - Name = "Allow", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Allow", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Authorization", - new HttpHeaderInfo () { - Name = "Authorization", - Type = HttpHeaderType.Request | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Authorization", + HttpHeaderType.Request | HttpHeaderType.MultiValue) }, { "CacheControl", - new HttpHeaderInfo () { - Name = "Cache-Control", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Cache-Control", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Connection", - new HttpHeaderInfo () { - Name = "Connection", - Type = HttpHeaderType.Request | - HttpHeaderType.Response | - HttpHeaderType.Restricted | - HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Connection", + HttpHeaderType.Request | + HttpHeaderType.Response | + HttpHeaderType.Restricted | + HttpHeaderType.MultiValue) }, { "ContentEncoding", - new HttpHeaderInfo () { - Name = "Content-Encoding", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Content-Encoding", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "ContentLanguage", - new HttpHeaderInfo () { - Name = "Content-Language", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Content-Language", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "ContentLength", - new HttpHeaderInfo () { - Name = "Content-Length", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Content-Length", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted) }, { "ContentLocation", - new HttpHeaderInfo () { - Name = "Content-Location", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Content-Location", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "ContentMd5", - new HttpHeaderInfo () { - Name = "Content-MD5", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Content-MD5", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "ContentRange", - new HttpHeaderInfo () { - Name = "Content-Range", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Content-Range", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "ContentType", - new HttpHeaderInfo () { - Name = "Content-Type", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Content-Type", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted) }, { "Cookie", - new HttpHeaderInfo () { - Name = "Cookie", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "Cookie", + HttpHeaderType.Request) }, { "Cookie2", - new HttpHeaderInfo () { - Name = "Cookie2", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "Cookie2", + HttpHeaderType.Request) }, { "Date", - new HttpHeaderInfo () { - Name = "Date", - Type = HttpHeaderType.Request | - HttpHeaderType.Response | - HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Date", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted) }, { "Expect", - new HttpHeaderInfo () { - Name = "Expect", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Expect", + HttpHeaderType.Request | HttpHeaderType.Restricted | HttpHeaderType.MultiValue) }, { "Expires", - new HttpHeaderInfo () { - Name = "Expires", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Expires", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "ETag", - new HttpHeaderInfo () { - Name = "ETag", - Type = HttpHeaderType.Response - } + new HttpHeaderInfo ( + "ETag", + HttpHeaderType.Response) }, { "From", - new HttpHeaderInfo () { - Name = "From", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "From", + HttpHeaderType.Request) }, { "Host", - new HttpHeaderInfo () { - Name = "Host", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Host", + HttpHeaderType.Request | HttpHeaderType.Restricted) }, { "IfMatch", - new HttpHeaderInfo () { - Name = "If-Match", - Type = HttpHeaderType.Request | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "If-Match", + HttpHeaderType.Request | HttpHeaderType.MultiValue) }, { "IfModifiedSince", - new HttpHeaderInfo () { - Name = "If-Modified-Since", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "If-Modified-Since", + HttpHeaderType.Request | HttpHeaderType.Restricted) }, { "IfNoneMatch", - new HttpHeaderInfo () { - Name = "If-None-Match", - Type = HttpHeaderType.Request | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "If-None-Match", + HttpHeaderType.Request | HttpHeaderType.MultiValue) }, { "IfRange", - new HttpHeaderInfo () { - Name = "If-Range", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "If-Range", + HttpHeaderType.Request) }, { "IfUnmodifiedSince", - new HttpHeaderInfo () { - Name = "If-Unmodified-Since", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "If-Unmodified-Since", + HttpHeaderType.Request) }, { "KeepAlive", - new HttpHeaderInfo () { - Name = "Keep-Alive", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Keep-Alive", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "LastModified", - new HttpHeaderInfo () { - Name = "Last-Modified", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Last-Modified", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "Location", - new HttpHeaderInfo () { - Name = "Location", - Type = HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Location", + HttpHeaderType.Response) }, { "MaxForwards", - new HttpHeaderInfo () { - Name = "Max-Forwards", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "Max-Forwards", + HttpHeaderType.Request) }, { "Pragma", - new HttpHeaderInfo () { - Name = "Pragma", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Pragma", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "ProxyConnection", - new HttpHeaderInfo () { - Name = "Proxy-Connection", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Proxy-Connection", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.Restricted) }, { "ProxyAuthenticate", - new HttpHeaderInfo () { - Name = "Proxy-Authenticate", - Type = HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Proxy-Authenticate", + HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "ProxyAuthorization", - new HttpHeaderInfo () { - Name = "Proxy-Authorization", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "Proxy-Authorization", + HttpHeaderType.Request) }, { "Public", - new HttpHeaderInfo () { - Name = "Public", - Type = HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Public", + HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Range", - new HttpHeaderInfo () { - Name = "Range", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Range", + HttpHeaderType.Request | HttpHeaderType.Restricted | HttpHeaderType.MultiValue) }, { "Referer", - new HttpHeaderInfo () { - Name = "Referer", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Referer", + HttpHeaderType.Request | HttpHeaderType.Restricted) }, { "RetryAfter", - new HttpHeaderInfo () { - Name = "Retry-After", - Type = HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Retry-After", + HttpHeaderType.Response) }, { "SecWebSocketAccept", - new HttpHeaderInfo () { - Name = "Sec-WebSocket-Accept", - Type = HttpHeaderType.Response | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Sec-WebSocket-Accept", + HttpHeaderType.Response | HttpHeaderType.Restricted) }, { "SecWebSocketExtensions", - new HttpHeaderInfo () { - Name = "Sec-WebSocket-Extensions", - Type = HttpHeaderType.Request | - HttpHeaderType.Response | - HttpHeaderType.Restricted | - HttpHeaderType.MultiValueInRequest - } + new HttpHeaderInfo ( + "Sec-WebSocket-Extensions", + HttpHeaderType.Request | + HttpHeaderType.Response | + HttpHeaderType.Restricted | + HttpHeaderType.MultiValueInRequest) }, { "SecWebSocketKey", - new HttpHeaderInfo () { - Name = "Sec-WebSocket-Key", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "Sec-WebSocket-Key", + HttpHeaderType.Request | HttpHeaderType.Restricted) }, { "SecWebSocketProtocol", - new HttpHeaderInfo () { - Name = "Sec-WebSocket-Protocol", - Type = HttpHeaderType.Request | - HttpHeaderType.Response | - HttpHeaderType.MultiValueInRequest - } + new HttpHeaderInfo ( + "Sec-WebSocket-Protocol", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValueInRequest) }, { "SecWebSocketVersion", - new HttpHeaderInfo () { - Name = "Sec-WebSocket-Version", - Type = HttpHeaderType.Request | - HttpHeaderType.Response | - HttpHeaderType.Restricted | - HttpHeaderType.MultiValueInResponse - } + new HttpHeaderInfo ( + "Sec-WebSocket-Version", + HttpHeaderType.Request | + HttpHeaderType.Response | + HttpHeaderType.Restricted | + HttpHeaderType.MultiValueInResponse) }, { "Server", - new HttpHeaderInfo () { - Name = "Server", - Type = HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Server", + HttpHeaderType.Response) }, { "SetCookie", - new HttpHeaderInfo () { - Name = "Set-Cookie", - Type = HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Set-Cookie", + HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "SetCookie2", - new HttpHeaderInfo () { - Name = "Set-Cookie2", - Type = HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Set-Cookie2", + HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Te", - new HttpHeaderInfo () { - Name = "TE", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "TE", + HttpHeaderType.Request) }, { "Trailer", - new HttpHeaderInfo () { - Name = "Trailer", - Type = HttpHeaderType.Request | HttpHeaderType.Response - } + new HttpHeaderInfo ( + "Trailer", + HttpHeaderType.Request | HttpHeaderType.Response) }, { "TransferEncoding", - new HttpHeaderInfo () { - Name = "Transfer-Encoding", - Type = HttpHeaderType.Request | - HttpHeaderType.Response | - HttpHeaderType.Restricted | - HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Transfer-Encoding", + HttpHeaderType.Request | + HttpHeaderType.Response | + HttpHeaderType.Restricted | + HttpHeaderType.MultiValue) }, { "Translate", - new HttpHeaderInfo () { - Name = "Translate", - Type = HttpHeaderType.Request - } + new HttpHeaderInfo ( + "Translate", + HttpHeaderType.Request) }, { "Upgrade", - new HttpHeaderInfo () { - Name = "Upgrade", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Upgrade", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "UserAgent", - new HttpHeaderInfo () { - Name = "User-Agent", - Type = HttpHeaderType.Request | HttpHeaderType.Restricted - } + new HttpHeaderInfo ( + "User-Agent", + HttpHeaderType.Request | HttpHeaderType.Restricted) }, { "Vary", - new HttpHeaderInfo () { - Name = "Vary", - Type = HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Vary", + HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Via", - new HttpHeaderInfo () { - Name = "Via", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Via", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "Warning", - new HttpHeaderInfo () { - Name = "Warning", - Type = HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "Warning", + HttpHeaderType.Request | HttpHeaderType.Response | HttpHeaderType.MultiValue) }, { "WwwAuthenticate", - new HttpHeaderInfo () { - Name = "WWW-Authenticate", - Type = HttpHeaderType.Response | HttpHeaderType.Restricted | HttpHeaderType.MultiValue - } + new HttpHeaderInfo ( + "WWW-Authenticate", + HttpHeaderType.Response | HttpHeaderType.Restricted | HttpHeaderType.MultiValue) } }; }