diff --git a/Example/bin/Debug_Ubuntu/example.exe b/Example/bin/Debug_Ubuntu/example.exe index f2ea3e55..87511c37 100755 Binary files a/Example/bin/Debug_Ubuntu/example.exe and b/Example/bin/Debug_Ubuntu/example.exe differ diff --git a/Example/bin/Debug_Ubuntu/example.exe.mdb b/Example/bin/Debug_Ubuntu/example.exe.mdb index 1e107adb..38e45ad9 100644 Binary files a/Example/bin/Debug_Ubuntu/example.exe.mdb and b/Example/bin/Debug_Ubuntu/example.exe.mdb differ diff --git a/Example/bin/Debug_Ubuntu/websocket-sharp.dll b/Example/bin/Debug_Ubuntu/websocket-sharp.dll index 6c916f76..f624d82a 100755 Binary files a/Example/bin/Debug_Ubuntu/websocket-sharp.dll and b/Example/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/Example/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/Example/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 2fb66402..63eb8ac7 100644 Binary files a/Example/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/Example/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/Example1/bin/Debug_Ubuntu/example1.exe b/Example1/bin/Debug_Ubuntu/example1.exe index e41b6afd..b77cf797 100755 Binary files a/Example1/bin/Debug_Ubuntu/example1.exe and b/Example1/bin/Debug_Ubuntu/example1.exe differ diff --git a/Example1/bin/Debug_Ubuntu/example1.exe.mdb b/Example1/bin/Debug_Ubuntu/example1.exe.mdb index cdaf9beb..b38b635c 100644 Binary files a/Example1/bin/Debug_Ubuntu/example1.exe.mdb and b/Example1/bin/Debug_Ubuntu/example1.exe.mdb differ diff --git a/Example1/bin/Debug_Ubuntu/websocket-sharp.dll b/Example1/bin/Debug_Ubuntu/websocket-sharp.dll index 6c916f76..f624d82a 100755 Binary files a/Example1/bin/Debug_Ubuntu/websocket-sharp.dll and b/Example1/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/Example1/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/Example1/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 2fb66402..63eb8ac7 100644 Binary files a/Example1/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/Example1/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/Example2/bin/Debug_Ubuntu/example2.exe b/Example2/bin/Debug_Ubuntu/example2.exe index 862ed12e..42d38660 100755 Binary files a/Example2/bin/Debug_Ubuntu/example2.exe and b/Example2/bin/Debug_Ubuntu/example2.exe differ diff --git a/Example2/bin/Debug_Ubuntu/example2.exe.mdb b/Example2/bin/Debug_Ubuntu/example2.exe.mdb index aa688f7b..c6e86391 100644 Binary files a/Example2/bin/Debug_Ubuntu/example2.exe.mdb and b/Example2/bin/Debug_Ubuntu/example2.exe.mdb differ diff --git a/Example2/bin/Debug_Ubuntu/websocket-sharp.dll b/Example2/bin/Debug_Ubuntu/websocket-sharp.dll index 6c916f76..f624d82a 100755 Binary files a/Example2/bin/Debug_Ubuntu/websocket-sharp.dll and b/Example2/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/Example2/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/Example2/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 2fb66402..63eb8ac7 100644 Binary files a/Example2/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/Example2/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/Example3/bin/Debug_Ubuntu/Example3.exe b/Example3/bin/Debug_Ubuntu/Example3.exe index 15d14075..8a4ca324 100755 Binary files a/Example3/bin/Debug_Ubuntu/Example3.exe and b/Example3/bin/Debug_Ubuntu/Example3.exe differ diff --git a/Example3/bin/Debug_Ubuntu/Example3.exe.mdb b/Example3/bin/Debug_Ubuntu/Example3.exe.mdb index dd578aaa..538dca00 100644 Binary files a/Example3/bin/Debug_Ubuntu/Example3.exe.mdb and b/Example3/bin/Debug_Ubuntu/Example3.exe.mdb differ diff --git a/Example3/bin/Debug_Ubuntu/websocket-sharp.dll b/Example3/bin/Debug_Ubuntu/websocket-sharp.dll index 6c916f76..f624d82a 100755 Binary files a/Example3/bin/Debug_Ubuntu/websocket-sharp.dll and b/Example3/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/Example3/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/Example3/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 2fb66402..63eb8ac7 100644 Binary files a/Example3/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/Example3/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 904ca64c..fbbe0a83 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -79,6 +79,29 @@ namespace WebSocketSharp { #region Internal Method + internal static bool IsText(this string value) + { + int len = value.Length; + for (int i = 0; i < len; i++) + { + char c = value[i]; + if (c < 0x20 && !"\r\n\t".Contains(c)) + return false; + + if (c == 0x7f) + return false; + + if (c == '\n' && ++i < len) + { + c = value[i]; + if (!" \t".Contains(c)) + return false; + } + } + + return true; + } + internal static bool IsToken(this string value) { foreach (char c in value) diff --git a/websocket-sharp/Net/WebHeaderCollection.cs b/websocket-sharp/Net/WebHeaderCollection.cs index 7db31aa1..767d1e09 100644 --- a/websocket-sharp/Net/WebHeaderCollection.cs +++ b/websocket-sharp/Net/WebHeaderCollection.cs @@ -1,14 +1,15 @@ // // WebHeaderCollection.cs -// Copied from System.Net.WebHeaderCollection +// Copied from System.Net.WebHeaderCollection.cs // // Authors: // Lawrence Pit (loz@cable.a2000.nl) // Gonzalo Paniagua Javier (gonzalo@ximian.com) // Miguel de Icaza (miguel@novell.com) // -// Copyright 2003 Ximian, Inc. (http://www.ximian.com) -// Copyright 2007 Novell, Inc. (http://www.novell.com) +// Copyright (c) 2003 Ximian, Inc. (http://www.ximian.com) +// Copyright (c) 2007 Novell, Inc. (http://www.novell.com) +// Copyright (c) 2012-2013 sta.blockhead (sta.blockhead@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -37,24 +38,30 @@ using System.Collections.Specialized; using System.Net; using System.Runtime.InteropServices; using System.Runtime.Serialization; +using System.Security.Permissions; using System.Text; - -// See RFC 2068 par 4.2 Message Headers - + namespace WebSocketSharp.Net { + /// + /// Provides a collection of the HTTP headers associated with a request or response. + /// [Serializable] - [ComVisible(true)] + [ComVisible (true)] public class WebHeaderCollection : NameValueCollection, ISerializable { + #region Fields + private static readonly Dictionary multiValue; private static readonly Dictionary restricted; private static readonly Dictionary restricted_response; private bool internallyCreated = false; - - // Static Initializer - + + #endregion + + #region Constructors + static WebHeaderCollection () { // the list of restricted header names as defined @@ -93,12 +100,12 @@ namespace WebSocketSharp.Net { multiValue.Add ("cache-control", true); multiValue.Add ("connection", true); multiValue.Add ("content-encoding", true); - multiValue.Add ("content-language", true); - multiValue.Add ("expect", true); + multiValue.Add ("content-language", true); + multiValue.Add ("expect", true); multiValue.Add ("if-match", true); multiValue.Add ("if-none-match", true); multiValue.Add ("proxy-authenticate", true); - multiValue.Add ("public", true); + multiValue.Add ("public", true); multiValue.Add ("range", true); multiValue.Add ("transfer-encoding", true); multiValue.Add ("upgrade", true); @@ -111,322 +118,140 @@ namespace WebSocketSharp.Net { multiValue.Add ("set-cookie", true); multiValue.Add ("set-cookie2", true); } - - // Constructors - public WebHeaderCollection () { } - - protected WebHeaderCollection ( - SerializationInfo serializationInfo, - StreamingContext streamingContext) - { - int count; - - try { - count = serializationInfo.GetInt32("Count"); - for (int i = 0; i < count; i++) - this.Add (serializationInfo.GetString (i.ToString ()), - serializationInfo.GetString ((count + i).ToString ())); - } catch (SerializationException){ - count = serializationInfo.GetInt32("count"); - for (int i = 0; i < count; i++) - this.Add (serializationInfo.GetString ("k" + i), - serializationInfo.GetString ("v" + i)); - } - - } - internal WebHeaderCollection (bool internallyCreated) { this.internallyCreated = internallyCreated; } - // Methods - - public void Add (string header) + /// + /// Initializes a new instance of the class + /// with the specified and . + /// + /// + /// A that holds the serialized object data. + /// + /// + /// A that contains the contextual information about the source or destination. + /// + protected WebHeaderCollection ( + SerializationInfo serializationInfo, StreamingContext streamingContext) { - if (header == null) - throw new ArgumentNullException ("header"); - int pos = header.IndexOf (':'); - if (pos == -1) - throw new ArgumentException ("no colon found", "header"); - this.Add (header.Substring (0, pos), - header.Substring (pos + 1)); - } - - public override void Add (string name, string value) - { - if (name == null) - throw new ArgumentNullException ("name"); - if (internallyCreated && IsRestricted (name)) - throw new ArgumentException ("This header must be modified with the appropiate property."); - this.AddWithoutValidate (name, value); - } - - protected void AddWithoutValidate (string headerName, string headerValue) - { - if (!IsHeaderName (headerName)) - throw new ArgumentException ("invalid header name: " + headerName, "headerName"); - if (headerValue == null) - headerValue = String.Empty; - else - headerValue = headerValue.Trim (); - if (!IsHeaderValue (headerValue)) - throw new ArgumentException ("invalid header value: " + headerValue, "headerValue"); - base.Add (headerName, headerValue); - } - - public override string [] GetValues (string header) - { - if (header == null) - throw new ArgumentNullException ("header"); - - string [] values = base.GetValues (header); - if (values == null || values.Length == 0) - return null; - - /* - if (IsMultiValue (header)) { - values = GetMultipleValues (values); - } - */ - - return values; - } - - public override string[] GetValues (int index) - { - string[] values = base.GetValues (index); - if (values == null || values.Length == 0) { - return(null); - } - - return(values); - } - - /* Now i wonder why this is here... - static string [] GetMultipleValues (string [] values) - { - ArrayList mvalues = new ArrayList (values.Length); - StringBuilder sb = null; - for (int i = 0; i < values.Length; ++i) { - string val = values [i]; - if (val.IndexOf (',') == -1) { - mvalues.Add (val); - continue; - } - - if (sb == null) - sb = new StringBuilder (); - - bool quote = false; - for (int k = 0; k < val.Length; k++) { - char c = val [k]; - if (c == '"') { - quote = !quote; - } else if (!quote && c == ',') { - mvalues.Add (sb.ToString ().Trim ()); - sb.Length = 0; - continue; - } - sb.Append (c); - } - - if (sb.Length > 0) { - mvalues.Add (sb.ToString ().Trim ()); - sb.Length = 0; - } - } - - return (string []) mvalues.ToArray (typeof (string)); - } - */ - - public static bool IsRestricted (string headerName) - { - if (headerName == null) - throw new ArgumentNullException ("headerName"); - - if (headerName == "") // MS throw nullexception here! - throw new ArgumentException ("empty string", "headerName"); - - if (!IsHeaderName (headerName)) - throw new ArgumentException ("Invalid character in header"); - - return restricted.ContainsKey (headerName); - } - - public static bool IsRestricted (string headerName, bool response) - { - if (String.IsNullOrEmpty (headerName)) - throw new ArgumentNullException ("headerName"); - - if (!IsHeaderName (headerName)) - throw new ArgumentException ("Invalid character in header"); - - - if (response) - return restricted_response.ContainsKey (headerName); - return restricted.ContainsKey (headerName); - } - - public override void OnDeserialization (object sender) - { - } - - public override void Remove (string name) - { - if (name == null) - throw new ArgumentNullException ("name"); - if (internallyCreated && IsRestricted (name)) - throw new ArgumentException ("restricted header"); - base.Remove (name); - } - - public override void Set (string name, string value) - { - if (name == null) - throw new ArgumentNullException ("name"); - if (internallyCreated && IsRestricted (name)) - throw new ArgumentException ("restricted header"); - if (!IsHeaderName (name)) - throw new ArgumentException ("invalid header name"); - if (value == null) - value = String.Empty; - else - value = value.Trim (); - if (!IsHeaderValue (value)) - throw new ArgumentException ("invalid header value"); - base.Set (name, value); - } - - public byte[] ToByteArray () - { - return Encoding.UTF8.GetBytes(ToString ()); - } - - internal string ToStringMultiValue () - { - StringBuilder sb = new StringBuilder(); - - int count = base.Count; - for (int i = 0; i < count ; i++) { - string key = GetKey (i); - if (IsMultiValue (key)) { - foreach (string v in GetValues (i)) { - sb.Append (key) - .Append (": ") - .Append (v) - .Append ("\r\n"); - } - } else { - sb.Append (key) - .Append (": ") - .Append (Get (i)) - .Append ("\r\n"); - } - } - return sb.Append("\r\n").ToString(); - } - - public override string ToString () - { - StringBuilder sb = new StringBuilder(); - - int count = base.Count; - for (int i = 0; i < count ; i++) - sb.Append (GetKey (i)) - .Append (": ") - .Append (Get (i)) - .Append ("\r\n"); - - return sb.Append("\r\n").ToString(); - } - - void ISerializable.GetObjectData ( - SerializationInfo serializationInfo, - StreamingContext streamingContext) - { - GetObjectData (serializationInfo, streamingContext); - } - - public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) - { - int count = base.Count; - serializationInfo.AddValue ("Count", count); - for (int i = 0; i < count; i++) { - serializationInfo.AddValue (i.ToString (), GetKey (i)); - serializationInfo.AddValue ((count + i).ToString (), Get (i)); + int count; + try { + count = serializationInfo.GetInt32("Count"); + for (int i = 0; i < count; i++) + this.Add ( + serializationInfo.GetString (i.ToString ()), + serializationInfo.GetString ((count + i).ToString ())); + } catch (SerializationException) { + count = serializationInfo.GetInt32("count"); + for (int i = 0; i < count; i++) + this.Add ( + serializationInfo.GetString ("k" + i), + serializationInfo.GetString ("v" + i)); } } - public override string[] AllKeys + /// + /// Initializes a new instance of the class. + /// + public WebHeaderCollection () + { + } + + #endregion + + #region Properties + + /// + /// Gets all header names in the collection. + /// + /// + /// An array of that contains all header names in the collection. + /// + public override string [] AllKeys { get { - return(base.AllKeys); + return base.AllKeys; } } - + + /// + /// Gets the number of headers in the collection. + /// + /// + /// An that indicates the number of headers in the collection. + /// public override int Count { get { - return(base.Count); + return base.Count; } } + /// + /// Gets or sets the specified request in the collection. + /// + /// + /// A that contains the value of the specified request . + /// + /// + /// A that contains a request header name. + /// + public string this [HttpRequestHeader header] + { + get { + return Get (RequestHeaderToString (header)); + } + + set { + // TODO: Support to throw InvalidOperationException. + + Add (header, value); + } + } + + /// + /// Gets or sets the specified response in the collection. + /// + /// + /// A that contains the value of the specified response . + /// + /// + /// A that contains a response header name. + /// + public string this [HttpResponseHeader header] + { + get { + return Get (ResponseHeaderToString (header)); + } + + set { + // TODO: Support to throw InvalidOperationException. + + Add (header, value); + } + } + + /// + /// Gets a collection of header names in the collection. + /// + /// + /// A that contains a collection of header names in the collection. + /// public override KeysCollection Keys { get { - return(base.Keys); + return base.Keys; } } - public override string Get (int index) - { - return(base.Get (index)); - } - - public override string Get (string name) - { - return(base.Get (name)); - } - - public override string GetKey (int index) - { - return(base.GetKey (index)); - } + #endregion - public void Add (HttpRequestHeader header, string value) - { - Add (RequestHeaderToString (header), value); - } + #region Private Methods - public void Remove (HttpRequestHeader header) - { - Remove (RequestHeaderToString (header)); - } - - public void Set (HttpRequestHeader header, string value) - { - Set (RequestHeaderToString (header), value); - } - - public void Add (HttpResponseHeader header, string value) - { - Add (ResponseHeaderToString (header), value); - } - - public void Remove (HttpResponseHeader header) - { - Remove (ResponseHeaderToString (header)); - } - - public void Set (HttpResponseHeader header, string value) - { - Set (ResponseHeaderToString (header), value); - } - - string RequestHeaderToString (HttpRequestHeader value) + static string RequestHeaderToString (HttpRequestHeader value) { switch (value){ case HttpRequestHeader.CacheControl: @@ -515,20 +340,8 @@ namespace WebSocketSharp.Net { throw new InvalidOperationException (); } } - - - public string this[HttpRequestHeader hrh] - { - get { - return Get (RequestHeaderToString (hrh)); - } - - set { - Add (RequestHeaderToString (hrh), value); - } - } - string ResponseHeaderToString (HttpResponseHeader value) + static string ResponseHeaderToString (HttpResponseHeader value) { switch (value){ case HttpResponseHeader.CacheControl: @@ -596,135 +409,601 @@ namespace WebSocketSharp.Net { } } - public string this[HttpResponseHeader hrh] + static string Trim (string value) { - get - { - return Get (ResponseHeaderToString (hrh)); + return value.IsNullOrEmpty () + ? String.Empty + : value.Trim (); + } + + #endregion + + #region Internal Methods + + internal static bool IsHeaderName (string name) + { + return name.IsNullOrEmpty () + ? false + : name.IsToken (); + } + + internal static bool IsHeaderValue (string value) + { + return value.IsText (); + } + + internal static bool IsMultiValue (string headerName) + { + return headerName.IsNullOrEmpty () + ? false + : multiValue.ContainsKey (headerName); + } + + internal string ToStringMultiValue () + { + var sb = new StringBuilder(); + int count = base.Count; + for (int i = 0; i < count ; i++) { + string key = GetKey (i); + if (IsMultiValue (key)) { + foreach (string v in GetValues (i)) { + sb.Append (key) + .Append (": ") + .Append (v) + .Append ("\r\n"); + } + } else { + sb.Append (key) + .Append (": ") + .Append (Get (i)) + .Append ("\r\n"); + } } - set - { - Add (ResponseHeaderToString (hrh), value); - } + return sb.Append("\r\n").ToString(); } - public override void Clear () - { - base.Clear (); - } - - public override IEnumerator GetEnumerator () - { - return(base.GetEnumerator ()); - } - - // Internal Methods - // With this we don't check for invalid characters in header. See bug #55994. internal void SetInternal (string header) { int pos = header.IndexOf (':'); if (pos == -1) - throw new ArgumentException ("no colon found", "header"); + throw new ArgumentException ("No colon found", "header"); SetInternal (header.Substring (0, pos), header.Substring (pos + 1)); } - internal void SetInternal (string name, string value) - { - if (value == null) - value = String.Empty; - else - value = value.Trim (); - if (!IsHeaderValue (value)) - throw new ArgumentException ("invalid header value"); - - if (IsMultiValue (name)) { - base.Add (name, value); - } else { - base.Remove (name); - base.Set (name, value); - } - } - internal void RemoveAndAdd (string name, string value) { - if (value == null) - value = String.Empty; - else - value = value.Trim (); - + value = Trim (value); base.Remove (name); base.Set (name, value); } internal void RemoveInternal (string name) { - if (name == null) + if (name.IsNull ()) throw new ArgumentNullException ("name"); + base.Remove (name); - } - - // Private Methods - - internal static bool IsMultiValue (string headerName) - { - if (headerName == null || headerName == "") - return false; - - return multiValue.ContainsKey (headerName); - } - - internal static bool IsHeaderValue (string value) - { - // TEXT any 8 bit value except CTL's (0-31 and 127) - // but including \r\n space and \t - // after a newline at least one space or \t must follow - // certain header fields allow comments () - - int len = value.Length; - for (int i = 0; i < len; i++) { - char c = value [i]; - if (c == 127) - return false; - if (c < 0x20 && (c != '\r' && c != '\n' && c != '\t')) - return false; - if (c == '\n' && ++i < len) { - c = value [i]; - if (c != ' ' && c != '\t') - return false; - } - } - - return true; - } - - internal static bool IsHeaderName (string name) - { - if (name == null || name.Length == 0) - return false; - - int len = name.Length; - for (int i = 0; i < len; i++) { - char c = name [i]; - if (c > 126 || !allowed_chars [(int) c]) - return false; - } - - return true; } - static bool [] allowed_chars = new bool [126] { - false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, true, false, true, true, true, true, false, false, false, true, - true, false, true, true, false, true, true, true, true, true, true, true, true, true, true, false, - false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, - false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, - false, true, false - }; + internal void SetInternal (string name, string value) + { + value = Trim (value); + if (!IsHeaderValue (value)) + throw new ArgumentException ("Invalid header value."); + + if (IsMultiValue (name)) { + base.Add (name, value); + } else { + base.Remove (name); + base.Set (name, value); + } + } + + #endregion + + #region Explicit Interface Implementation + + /// + /// Populates the specified with the data needed to serialize the . + /// + /// + /// A that holds the serialized object data. + /// + /// + /// A that specifies the destination for the serialization. + /// + [SecurityPermission (SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter, SerializationFormatter = true)] + void ISerializable.GetObjectData ( + SerializationInfo serializationInfo, StreamingContext streamingContext) + { + GetObjectData (serializationInfo, streamingContext); + } + + #endregion + + #region Protected Methods + + /// + /// Adds a header to the collection without checking whether the header is on the restricted header list. + /// + /// + /// A that contains the name of the header to add. + /// + /// + /// A that contains the value of the header to add. + /// + /// + /// + /// is , , or + /// contains invalid characters. + /// + /// + /// -or- + /// + /// + /// contains invalid characters. + /// + /// + protected void AddWithoutValidate (string headerName, string headerValue) + { + var name = Trim (headerName); + if (!IsHeaderName (name)) + throw new ArgumentException ("Invalid header name: " + name, "headerName"); + + var value = Trim (headerValue); + if (!IsHeaderValue (value)) + throw new ArgumentException ("Invalid header value: " + value, "headerValue"); + + base.Add (name, value); + } + + #endregion + + #region Public Methods + + /// + /// Adds the specified to the collection. + /// + /// + /// A that contains a header with the name and value separated by a colon (:). + /// + /// + /// is or a . + /// + /// + /// does not contain a colon. + /// + public void Add (string header) + { + if (header.IsNullOrEmpty ()) + throw new ArgumentNullException ("header"); + + int pos = header.IndexOf (':'); + if (pos == -1) + throw new ArgumentException ("No colon found", "header"); + + Add (header.Substring (0, pos), header.Substring (pos + 1)); + } + + /// + /// Adds the specified request with the specified to the collection. + /// + /// + /// A that contains the name of the request header to add. + /// + /// + /// A that contains the value of the header to add. + /// + public void Add (HttpRequestHeader header, string value) + { + Add (RequestHeaderToString (header), value); + } + + /// + /// Adds the specified response with the specified to the collection. + /// + /// + /// A that contains the name of the response header to add. + /// + /// + /// A that contains the value of the header to add. + /// + public void Add (HttpResponseHeader header, string value) + { + Add (ResponseHeaderToString (header), value); + } + + /// + /// Adds a header with the specified and to the collection. + /// + /// + /// A that contains the name of the header to add. + /// + /// + /// A that contains the value of the header to add. + /// + /// + /// + /// is or a . + /// + /// + /// -or- + /// + /// + /// is a restricted header that must be set with a property setting. + /// + /// + /// -or- + /// + /// + /// + /// The length of is greater than 65535. + /// + public override void Add (string name, string value) + { + if (internallyCreated && IsRestricted (name)) + throw new ArgumentException ("This header must be modified with the appropiate property."); + + if (value.Length > 65535) + throw new ArgumentOutOfRangeException ("value", "The length must not be greater than 65535."); + + AddWithoutValidate (name, value); + } + + /// + /// Removes all headers from the collection. + /// + public override void Clear () + { + base.Clear (); + } + + /// + /// Get the value of the header with the specified in the collection. + /// + /// + /// A that receives the value of the header. + /// + /// + /// An that is the zero-based index of the header to get. + /// + public override string Get (int index) + { + return base.Get (index); + } + + /// + /// Get the value of the header with the specified in the collection. + /// + /// + /// A that receives the value of the header. + /// if there is no header with in the collection. + /// + /// + /// A that contains the name of the header to get. + /// + public override string Get (string name) + { + return base.Get (name); + } + + /// + /// Gets the enumerator to use to iterate through the . + /// + /// + /// An instance of an implementation of the interface + /// to use to iterate through the . + /// + public override IEnumerator GetEnumerator () + { + return base.GetEnumerator (); + } + + /// + /// Get the header name at the specified position in the collection. + /// + /// + /// A that receives the header name. + /// + /// + /// An is the zero-based index of the key to get from the collection. + /// + public override string GetKey (int index) + { + return base.GetKey (index); + } + + /// + /// Gets an array of header values stored in the specified name. + /// + /// + /// An array of that receives the header values. + /// + /// + /// A that contains a header name. + /// + public override string [] GetValues (string header) + { + string [] values = base.GetValues (header); + return values.IsNull () || values.Length == 0 + ? null + : values; + } + + /// + /// Gets an array of header values stored in the specified position of the header collection. + /// + /// + /// An array of that receives the header values. + /// + /// + /// An is the zero-based index of the header in the collection. + /// + public override string [] GetValues (int index) + { + string [] values = base.GetValues (index); + return values.IsNull () || values.Length == 0 + ? null + : values; + } + + /// + /// Populates the specified with the data needed to serialize the . + /// + /// + /// A that holds the serialized object data. + /// + /// + /// A that specifies the destination for the serialization. + /// + [SecurityPermission (SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + public override void GetObjectData ( + SerializationInfo serializationInfo, StreamingContext streamingContext) + { + int count = base.Count; + serializationInfo.AddValue ("Count", count); + for (int i = 0; i < count; i++) { + serializationInfo.AddValue (i.ToString (), GetKey (i)); + serializationInfo.AddValue ((count + i).ToString (), Get (i)); + } + } + + /// + /// Determines whether the specified header can be set for the request. + /// + /// + /// true if the header is restricted; otherwise, false. + /// + /// + /// A that contains the name of the header to test. + /// + /// + /// is or . + /// + /// + /// contains invalid characters. + /// + public static bool IsRestricted (string headerName) + { + return IsRestricted (headerName, false); + } + + /// + /// Determines whether the specified header can be set for the request or the response. + /// + /// + /// true if the header is restricted; otherwise, false. + /// + /// + /// A that contains the name of the header to test. + /// + /// + /// true if does the test for the response; for the request, false. + /// + /// + /// is or . + /// + /// + /// contains invalid characters. + /// + public static bool IsRestricted (string headerName, bool response) + { + if (headerName.IsNullOrEmpty ()) + throw new ArgumentNullException ("headerName", "Must not be null or empty."); + + var name = headerName.Trim (); + if (!IsHeaderName (name)) + throw new ArgumentException ("Invalid character in header."); + + return response + ? restricted_response.ContainsKey (name) + : restricted.ContainsKey (name); + } + + /// + /// Implements the interface and raises the deserialization event + /// when the deserialization is complete. + /// + /// + /// An that contains the source of the deserialization event. + /// + public override void OnDeserialization (object sender) + { + } + + /// + /// Removes the specified header from the collection. + /// + /// + /// A to remove from the collection. + /// + public void Remove (HttpRequestHeader header) + { + // TODO: Support to throw InvalidOperationException. + + Remove (RequestHeaderToString (header)); + } + + /// + /// Removes the specified header from the collection. + /// + /// + /// A to remove from the collection. + /// + public void Remove (HttpResponseHeader header) + { + // TODO: Support to throw InvalidOperationException. + + Remove (ResponseHeaderToString (header)); + } + + /// + /// Removes the specified header from the collection. + /// + /// + /// A that contains the name of the header to remove from the collection. + /// + /// + /// is or . + /// + /// + /// + /// contains invalid characters. + /// + /// + /// -or- + /// + /// + /// is a restricted header name. + /// + /// + public override void Remove (string name) + { + if (name.IsNullOrEmpty ()) + throw new ArgumentNullException ("name"); + + name = name.Trim (); + if (!IsHeaderName (name)) + throw new ArgumentException ("Invalid characters in header."); + + if (internallyCreated && IsRestricted (name)) + throw new ArgumentException ("Restricted header."); + + base.Remove (name); + } + + /// + /// Sets the specified header to the specified value. + /// + /// + /// A to set. + /// + /// + /// A that contains the value of the header to set. + /// + public void Set (HttpRequestHeader header, string value) + { + // TODO: Support to throw InvalidOperationException. + + Set (RequestHeaderToString (header), value); + } + + /// + /// Sets the specified header to the specified value. + /// + /// + /// A to set. + /// + /// + /// A that contains the value of the header to set. + /// + public void Set (HttpResponseHeader header, string value) + { + // TODO: Support to throw InvalidOperationException. + + Set (ResponseHeaderToString (header), value); + } + + /// + /// Sets the specified header to the specified value. + /// + /// + /// A that contains the name of the header to set. + /// + /// + /// A that contains the value of the header to set. + /// + /// + /// is or . + /// + /// + /// + /// or contain invalid characters. + /// + /// + /// -or- + /// + /// + /// is a restricted header name. + /// + /// + /// + /// The length of is greater than 65535. + /// + public override void Set (string name, string value) + { + if (name.IsNullOrEmpty ()) + throw new ArgumentNullException ("name"); + + name = name.Trim (); + if (!IsHeaderName (name)) + throw new ArgumentException ("Invalid header name."); + + if (internallyCreated && IsRestricted (name)) + throw new ArgumentException ("Restricted header."); + + value = Trim (value); + if (value.Length > 65535) + throw new ArgumentOutOfRangeException ("value", "The length must not be greater than 65535."); + + if (!IsHeaderValue (value)) + throw new ArgumentException ("Invalid header value."); + + base.Set (name, value); + } + + /// + /// Converts the current to an array of . + /// + /// + /// An array of that receives the converted current . + /// + public byte [] ToByteArray () + { + return Encoding.UTF8.GetBytes (ToString ()); + } + + /// + /// Returns a that represents the current . + /// + /// + /// A that represents the current . + /// + public override string ToString () + { + var sb = new StringBuilder(); + for (int i = 0; i < Count ; i++) + sb.Append (GetKey (i)) + .Append (": ") + .Append (Get (i)) + .Append ("\r\n"); + + return sb.Append("\r\n").ToString(); + } + + #endregion } } diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll index 6c916f76..f624d82a 100755 Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb index 2fb66402..63eb8ac7 100644 Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ diff --git a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll index 8de72964..ef94d7e5 100755 Binary files a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll differ diff --git a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.xml b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.xml index 3a9770d8..597eb293 100644 --- a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.xml +++ b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.xml @@ -2954,6 +2954,403 @@ The string to encode. The TextWriter output stream containing the encoded string. + + + Provides a collection of the HTTP headers associated with a request or response. + + + + + Initializes a new instance of the class + with the specified and . + + + A that holds the serialized object data. + + + A that contains the contextual information about the source or destination. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the specified request in the collection. + + + A that contains the value of the specified request . + + + A that contains a request header name. + + + + + Gets or sets the specified response in the collection. + + + A that contains the value of the specified response . + + + A that contains a response header name. + + + + + Gets all header names in the collection. + + + An array of that contains all header names in the collection. + + + + + Gets the number of headers in the collection. + + + An that indicates the number of headers in the collection. + + + + + Gets a collection of header names in the collection. + + + A that contains a collection of header names in the collection. + + + + + Populates the specified with the data needed to serialize the . + + + A that holds the serialized object data. + + + A that specifies the destination for the serialization. + + + + + Adds a header to the collection without checking whether the header is on the restricted header list. + + + A that contains the name of the header to add. + + + A that contains the value of the header to add. + + + + is , , or + contains invalid characters. + + + -or- + + + contains invalid characters. + + + + + + Adds the specified to the collection. + + + A that contains a header with the name and value separated by a colon (:). + + + is or a . + + + does not contain a colon. + + + + + Adds the specified request with the specified to the collection. + + + A that contains the name of the request header to add. + + + A that contains the value of the header to add. + + + + + Adds the specified response with the specified to the collection. + + + A that contains the name of the response header to add. + + + A that contains the value of the header to add. + + + + + Adds a header with the specified and to the collection. + + + A that contains the name of the header to add. + + + A that contains the value of the header to add. + + + + is or a . + + + -or- + + + is a restricted header that must be set with a property setting. + + + -or- + + + + The length of is greater than 65535. + + + + + Removes all headers from the collection. + + + + + Get the value of the header with the specified in the collection. + + + A that receives the value of the header. + + + An that is the zero-based index of the header to get. + + + + + Get the value of the header with the specified in the collection. + + + A that receives the value of the header. + if there is no header with in the collection. + + + A that contains the name of the header to get. + + + + + Gets the enumerator to use to iterate through the . + + + An instance of an implementation of the interface + to use to iterate through the . + + + + + Get the header name at the specified position in the collection. + + + A that receives the header name. + + + An is the zero-based index of the key to get from the collection. + + + + + Gets an array of header values stored in the specified name. + + + An array of that receives the header values. + + + A that contains a header name. + + + + + Gets an array of header values stored in the specified position of the header collection. + + + An array of that receives the header values. + + + An is the zero-based index of the header in the collection. + + + + + Populates the specified with the data needed to serialize the . + + + A that holds the serialized object data. + + + A that specifies the destination for the serialization. + + + + + Determines whether the specified header can be set for the request. + + + true if the header is restricted; otherwise, false. + + + A that contains the name of the header to test. + + + is or . + + + contains invalid characters. + + + + + Determines whether the specified header can be set for the request or the response. + + + true if the header is restricted; otherwise, false. + + + A that contains the name of the header to test. + + + true if does the test for the response; for the request, false. + + + is or . + + + contains invalid characters. + + + + + Implements the interface and raises the deserialization event + when the deserialization is complete. + + + An that contains the source of the deserialization event. + + + + + Removes the specified header from the collection. + + + A to remove from the collection. + + + + + Removes the specified header from the collection. + + + A to remove from the collection. + + + + + Removes the specified header from the collection. + + + A that contains the name of the header to remove from the collection. + + + is or . + + + + contains invalid characters. + + + -or- + + + is a restricted header name. + + + + + + Sets the specified header to the specified value. + + + A to set. + + + A that contains the value of the header to set. + + + + + Sets the specified header to the specified value. + + + A to set. + + + A that contains the value of the header to set. + + + + + Sets the specified header to the specified value. + + + A that contains the name of the header to set. + + + A that contains the value of the header to set. + + + is or . + + + + or contain invalid characters. + + + -or- + + + is a restricted header name. + + + + The length of is greater than 65535. + + + + + Converts the current to an array of . + + + An array of that receives the converted current . + + + + + Returns a that represents the current . + + + A that represents the current . + + Provides a simple HTTP server that allows to accept the WebSocket connection requests. diff --git a/websocket-sharp/doc/html/WebSocketSharp.Net/WebHeaderCollection.html b/websocket-sharp/doc/html/WebSocketSharp.Net/WebHeaderCollection.html index e772ff62..636299f6 100644 --- a/websocket-sharp/doc/html/WebSocketSharp.Net/WebHeaderCollection.html +++ b/websocket-sharp/doc/html/WebSocketSharp.Net/WebHeaderCollection.html @@ -207,8 +207,8 @@

WebHeaderCollection Class

- Documentation for this section has not yet been entered. -

+ Provides a collection of the HTTP headers associated with a request or response. +

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public class WebHeaderCollection : System.Collections.Specialized.NameValueCollection, System.Runtime.Serialization.ISerializable
@@ -243,8 +243,8 @@ ()
- Documentation for this section has not yet been entered. - + Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class. + @@ -265,8 +265,9 @@ (System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) - Documentation for this section has not yet been entered. - + Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class + with the specified System.Runtime.Serialization.SerializationInfo and System.Runtime.Serialization.StreamingContext. + @@ -284,7 +285,9 @@ - string[]. Documentation for this section has not yet been entered. + string[]. + Gets all header names in the collection. + [read-only]
override
@@ -296,7 +299,9 @@ int - . Documentation for this section has not yet been entered. + . + Gets the number of headers in the collection. + @@ -313,7 +318,9 @@ string - . Documentation for this section has not yet been entered. + . + Gets or sets the specified request header in the collection. + @@ -330,7 +337,9 @@ string - . Documentation for this section has not yet been entered. + . + Gets or sets the specified response header in the collection. + [read-only]
override
@@ -342,7 +351,9 @@ System.Collections.Specialized.NameObjectCollectionBase.KeysCollection - . Documentation for this section has not yet been entered. + . + Gets a collection of header names in the collection. + @@ -359,7 +370,9 @@ Add - (string)
Documentation for this section has not yet been entered.
+ (string)
+ Adds the specified header to the collection. +
@@ -369,7 +382,9 @@ Add - (System.Net.HttpRequestHeader, string)
Documentation for this section has not yet been entered.
+ (System.Net.HttpRequestHeader, string)
+ Adds the specified request header with the specified value to the collection. +
@@ -379,7 +394,9 @@ Add - (System.Net.HttpResponseHeader, string)
Documentation for this section has not yet been entered.
+ (System.Net.HttpResponseHeader, string)
+ Adds the specified response header with the specified value to the collection. +
@@ -388,7 +405,9 @@ Add - (string, string)
Documentation for this section has not yet been entered.
+ (string, string)
+ Adds a header with the specified name and value to the collection. +
@@ -397,7 +416,9 @@ Clear - ()
Documentation for this section has not yet been entered.
+ ()
+ Removes all headers from the collection. +
@@ -406,7 +427,9 @@ Get - (int) : string
Documentation for this section has not yet been entered.
+ (int) : string
+ Get the value of the header with the specified index in the collection. +
@@ -415,7 +438,9 @@ Get - (string) : string
Documentation for this section has not yet been entered.
+ (string) : string
+ Get the value of the header with the specified name in the collection. +
@@ -424,7 +449,9 @@ GetEnumerator - () : IEnumerator
Documentation for this section has not yet been entered.
+ () : IEnumerator
+ Gets the enumerator to use to iterate through the WebSocketSharp.Net.WebHeaderCollection. +
@@ -433,7 +460,9 @@ GetKey - (int) : string
Documentation for this section has not yet been entered.
+ (int) : string
+ Get the header name at the specified index position in the collection. +
@@ -442,7 +471,9 @@ GetObjectData - (System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
Documentation for this section has not yet been entered.
+ (System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
+ Populates the specified System.Runtime.Serialization.SerializationInfo with the data needed to serialize the WebSocketSharp.Net.WebHeaderCollection. +
@@ -451,7 +482,9 @@ GetValues - (int) : string[]
Documentation for this section has not yet been entered.
+ (int) : string[]
+ Gets an array of header values stored in the specified index position of the header collection. +
@@ -460,7 +493,9 @@ GetValues - (string) : string[]
Documentation for this section has not yet been entered.
+ (string) : string[]
+ Gets an array of header values stored in the specified header name. +
@@ -469,7 +504,9 @@ IsRestricted - (string) : bool
Documentation for this section has not yet been entered.
+ (string) : bool
+ Determines whether the specified header can be set for the request. +
@@ -478,7 +515,9 @@ IsRestricted - (string, bool) : bool
Documentation for this section has not yet been entered.
+ (string, bool) : bool
+ Determines whether the specified header can be set for the request or the response. +
@@ -487,7 +526,10 @@ OnDeserialization - (object)
Documentation for this section has not yet been entered.
+ (object)
+ Implements the System.Runtime.Serialization.ISerializable interface and raises the deserialization event + when the deserialization is complete. +
@@ -497,7 +539,9 @@ Remove - (System.Net.HttpRequestHeader)
Documentation for this section has not yet been entered.
+ (System.Net.HttpRequestHeader)
+ Removes the specified header from the collection. +
@@ -507,7 +551,9 @@ Remove - (System.Net.HttpResponseHeader)
Documentation for this section has not yet been entered.
+ (System.Net.HttpResponseHeader)
+ Removes the specified header from the collection. +
@@ -516,7 +562,9 @@ Remove - (string)
Documentation for this section has not yet been entered.
+ (string)
+ Removes the specified header from the collection. +
@@ -526,7 +574,9 @@ Set - (System.Net.HttpRequestHeader, string)
Documentation for this section has not yet been entered.
+ (System.Net.HttpRequestHeader, string)
+ Sets the specified header to the specified value. +
@@ -536,7 +586,9 @@ Set - (System.Net.HttpResponseHeader, string)
Documentation for this section has not yet been entered.
+ (System.Net.HttpResponseHeader, string)
+ Sets the specified header to the specified value. +
@@ -545,7 +597,9 @@ Set - (string, string)
Documentation for this section has not yet been entered.
+ (string, string)
+ Sets the specified header to the specified value. +
@@ -555,7 +609,9 @@ ToByteArray - () : byte[]
Documentation for this section has not yet been entered.
+ () : byte[]
+ Converts the current WebSocketSharp.Net.WebHeaderCollection to an array of byte. +
@@ -564,7 +620,9 @@ ToString - () : string
Documentation for this section has not yet been entered.
+ () : string
+ Returns a string that represents the current WebSocketSharp.Net.WebHeaderCollection. +
@@ -581,7 +639,9 @@ AddWithoutValidate - (string, string)
Documentation for this section has not yet been entered.
+ (string, string)
+ Adds a header to the collection without checking whether the header is on the restricted header list. +
@@ -601,8 +661,8 @@ - Documentation for this section has not yet been entered. - + Populates the specified System.Runtime.Serialization.SerializationInfo with the data needed to serialize the WebSocketSharp.Net.WebHeaderCollection. + @@ -667,8 +727,8 @@

WebHeaderCollection Constructor

- Documentation for this section has not yet been entered. -

+ Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class. +

Syntax

public WebHeaderCollection ()

Remarks

@@ -683,8 +743,9 @@

WebHeaderCollection Constructor

- Documentation for this section has not yet been entered. -

+ Initializes a new instance of the WebSocketSharp.Net.WebHeaderCollection class + with the specified System.Runtime.Serialization.SerializationInfo and System.Runtime.Serialization.StreamingContext. +

Syntax

protected WebHeaderCollection (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)

Parameters

@@ -694,14 +755,14 @@ serializationInfo
- Documentation for this section has not yet been entered. -
+ A System.Runtime.Serialization.SerializationInfo that holds the serialized object data. +
streamingContext
- Documentation for this section has not yet been entered. -
+ A System.Runtime.Serialization.StreamingContext that contains the contextual information about the source or destination. +

Remarks

@@ -716,8 +777,8 @@

Add Method

- Documentation for this section has not yet been entered. -

+ Adds the specified header to the collection. +

Syntax

public void Add (string header)

Parameters

@@ -727,10 +788,35 @@ header
- Documentation for this section has not yet been entered. -
+ A string that contains a header with the name and value separated by a colon (:). +
+

Exceptions

+
+ + + + + + + + + + + + + +
TypeReason
+ ArgumentNullException + + header is null or a string.Empty. +
+ ArgumentException + + header does not contain a colon. +
+

Remarks

Documentation for this section has not yet been entered. @@ -743,8 +829,8 @@

Add Method

- Documentation for this section has not yet been entered. -

+ Adds the specified request header with the specified value to the collection. +

Syntax

public void Add (System.Net.HttpRequestHeader header, string value)

Parameters

@@ -754,14 +840,14 @@ header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpRequestHeader that contains the name of the request header to add. +
value
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to add. +

Remarks

@@ -776,8 +862,8 @@

Add Method

- Documentation for this section has not yet been entered. -

+ Adds the specified response header with the specified value to the collection. +

Syntax

public void Add (System.Net.HttpResponseHeader header, string value)

Parameters

@@ -787,14 +873,14 @@ header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpResponseHeader that contains the name of the response header to add. +
value
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to add. +

Remarks

@@ -809,8 +895,8 @@

Add Method

- Documentation for this section has not yet been entered. -

+ Adds a header with the specified name and value to the collection. +

Syntax

public override void Add (string name, string value)

Parameters

@@ -820,16 +906,52 @@ name
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to add. +
value
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to add. +
+

Exceptions

+
+ + + + + + + + + + + + + +
TypeReason
+ ArgumentException + +

+ name is null or a string.Empty. +

+

+ -or- +

+

+ name is a restricted header that must be set with a property setting. +

+

+ -or- +

+
+ ArgumentOutOfRangeException + + The length of value is greater than 65535. +
+

Remarks

Documentation for this section has not yet been entered. @@ -842,8 +964,8 @@

AddWithoutValidate Method

- Documentation for this section has not yet been entered. -

+ Adds a header to the collection without checking whether the header is on the restricted header list. +

Syntax

protected void AddWithoutValidate (string headerName, string headerValue)

Parameters

@@ -853,16 +975,42 @@ headerName
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to add. +
headerValue
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to add. +
+

Exceptions

+
+ + + + + + + + + +
TypeReason
+ ArgumentException + +

+ headerName is null, string.Empty, or + contains invalid characters. +

+

+ -or- +

+

+ headerValue contains invalid characters. +

+
+

Remarks

Documentation for this section has not yet been entered. @@ -875,14 +1023,14 @@

AllKeys Property

- Documentation for this section has not yet been entered. -

+ Gets all header names in the collection. +

Syntax

public override string[] AllKeys { get; }

Value

- Documentation for this section has not yet been entered. -
+ An array of string that contains all header names in the collection. +

Remarks

Documentation for this section has not yet been entered. @@ -895,8 +1043,8 @@

Clear Method

- Documentation for this section has not yet been entered. -

+ Removes all headers from the collection. +

Syntax

public override void Clear ()

Remarks

@@ -911,14 +1059,14 @@

Count Property

- Documentation for this section has not yet been entered. -

+ Gets the number of headers in the collection. +

Syntax

public override int Count { get; }

Value

- Documentation for this section has not yet been entered. -
+ An int that indicates the number of headers in the collection. +

Remarks

Documentation for this section has not yet been entered. @@ -931,8 +1079,8 @@

Get Method

- Documentation for this section has not yet been entered. -

+ Get the value of the header with the specified index in the collection. +

Syntax

public override string Get (int index)

Parameters

@@ -942,14 +1090,14 @@ index
- Documentation for this section has not yet been entered. -
+ An int that is the zero-based index of the header to get. +

Returns

- Documentation for this section has not yet been entered. -
+ A string that receives the value of the header. +

Remarks

Documentation for this section has not yet been entered. @@ -962,8 +1110,8 @@

Get Method

- Documentation for this section has not yet been entered. -

+ Get the value of the header with the specified name in the collection. +

Syntax

public override string Get (string name)

Parameters

@@ -973,14 +1121,15 @@ name
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to get. +

Returns

- Documentation for this section has not yet been entered. -
+ A string that receives the value of the header. + null if there is no header with name in the collection. +

Remarks

Documentation for this section has not yet been entered. @@ -993,14 +1142,15 @@

GetEnumerator Method

- Documentation for this section has not yet been entered. -

+ Gets the enumerator to use to iterate through the WebSocketSharp.Net.WebHeaderCollection. +

Syntax

public override IEnumerator GetEnumerator ()

Returns

- Documentation for this section has not yet been entered. -
+ An instance of an implementation of the IEnumerator interface + to use to iterate through the WebSocketSharp.Net.WebHeaderCollection. +

Remarks

Documentation for this section has not yet been entered. @@ -1013,8 +1163,8 @@

GetKey Method

- Documentation for this section has not yet been entered. -

+ Get the header name at the specified index position in the collection. +

Syntax

public override string GetKey (int index)

Parameters

@@ -1024,14 +1174,14 @@ index
- Documentation for this section has not yet been entered. -
+ An int is the zero-based index of the key to get from the collection. +

Returns

- Documentation for this section has not yet been entered. -
+ A string that receives the header name. +

Remarks

Documentation for this section has not yet been entered. @@ -1044,8 +1194,8 @@

GetObjectData Method

- Documentation for this section has not yet been entered. -

+ Populates the specified System.Runtime.Serialization.SerializationInfo with the data needed to serialize the WebSocketSharp.Net.WebHeaderCollection. +

Syntax

public override void GetObjectData (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)

Parameters

@@ -1055,14 +1205,14 @@ serializationInfo
- Documentation for this section has not yet been entered. -
+ A System.Runtime.Serialization.SerializationInfo that holds the serialized object data. +
streamingContext
- Documentation for this section has not yet been entered. -
+ A System.Runtime.Serialization.StreamingContext that specifies the destination for the serialization. +

Remarks

@@ -1077,8 +1227,8 @@

GetValues Method

- Documentation for this section has not yet been entered. -

+ Gets an array of header values stored in the specified index position of the header collection. +

Syntax

public override string[] GetValues (int index)

Parameters

@@ -1088,14 +1238,14 @@ index
- Documentation for this section has not yet been entered. -
+ An int is the zero-based index of the header in the collection. +

Returns

- Documentation for this section has not yet been entered. -
+ An array of string that receives the header values. +

Remarks

Documentation for this section has not yet been entered. @@ -1108,8 +1258,8 @@

GetValues Method

- Documentation for this section has not yet been entered. -

+ Gets an array of header values stored in the specified header name. +

Syntax

public override string[] GetValues (string header)

Parameters

@@ -1119,14 +1269,14 @@ header
- Documentation for this section has not yet been entered. -
+ A string that contains a header name. +

Returns

- Documentation for this section has not yet been entered. -
+ An array of string that receives the header values. +

Remarks

Documentation for this section has not yet been entered. @@ -1139,8 +1289,8 @@

IsRestricted Method

- Documentation for this section has not yet been entered. -

+ Determines whether the specified header can be set for the request. +

Syntax

public static bool IsRestricted (string headerName)

Parameters

@@ -1150,13 +1300,38 @@ headerName
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to test. +

Returns

- Documentation for this section has not yet been entered. + true if the header is restricted; otherwise, false. +
+

Exceptions

+
+ + + + + + + + + + + + + +
TypeReason
+ ArgumentNullException + + headerName is null or string.Empty. +
+ ArgumentException + + headerName contains invalid characters. +

Remarks

@@ -1170,8 +1345,8 @@

IsRestricted Method

- Documentation for this section has not yet been entered. -

+ Determines whether the specified header can be set for the request or the response. +

Syntax

public static bool IsRestricted (string headerName, bool response)

Parameters

@@ -1181,19 +1356,44 @@ headerName
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to test. +
response
- Documentation for this section has not yet been entered. -
+ true if does the test for the response; for the request, false. +

Returns

- Documentation for this section has not yet been entered. + true if the header is restricted; otherwise, false. +
+

Exceptions

+
+ + + + + + + + + + + + + +
TypeReason
+ ArgumentNullException + + headerName is null or string.Empty. +
+ ArgumentException + + headerName contains invalid characters. +

Remarks

@@ -1207,28 +1407,28 @@

Item Property

- Documentation for this section has not yet been entered. -

+ Gets or sets the specified request header in the collection. +

Syntax

This is the default property for this class. -

public string this [System.Net.HttpRequestHeader hrh] { get; set; }
+

public string this [System.Net.HttpRequestHeader header] { get; set; }

Parameters

- hrh + header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpRequestHeader that contains a request header name. +

Value

- Documentation for this section has not yet been entered. -
+ A string that contains the value of the specified request header. +

Remarks

Documentation for this section has not yet been entered. @@ -1241,28 +1441,28 @@

Item Property

- Documentation for this section has not yet been entered. -

+ Gets or sets the specified response header in the collection. +

Syntax

This is the default property for this class. -

public string this [System.Net.HttpResponseHeader hrh] { get; set; }
+

public string this [System.Net.HttpResponseHeader header] { get; set; }

Parameters

- hrh + header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpResponseHeader that contains a response header name. +

Value

- Documentation for this section has not yet been entered. -
+ A string that contains the value of the specified response header. +

Remarks

Documentation for this section has not yet been entered. @@ -1275,14 +1475,14 @@

Keys Property

- Documentation for this section has not yet been entered. -

+ Gets a collection of header names in the collection. +

Syntax

Value

- Documentation for this section has not yet been entered. -
+ A System.Collections.Specialized.NameObjectCollectionBase.KeysCollection that contains a collection of header names in the collection. +

Remarks

Documentation for this section has not yet been entered. @@ -1295,8 +1495,9 @@

OnDeserialization Method

- Documentation for this section has not yet been entered. -

+ Implements the System.Runtime.Serialization.ISerializable interface and raises the deserialization event + when the deserialization is complete. +

Syntax

public override void OnDeserialization (object sender)

Parameters

@@ -1306,8 +1507,8 @@ sender
- Documentation for this section has not yet been entered. -
+ An object that contains the source of the deserialization event. +

Remarks

@@ -1322,8 +1523,8 @@

Remove Method

- Documentation for this section has not yet been entered. -

+ Removes the specified header from the collection. +

Syntax

public void Remove (System.Net.HttpRequestHeader header)

Parameters

@@ -1333,8 +1534,8 @@ header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpRequestHeader to remove from the collection. +

Remarks

@@ -1349,8 +1550,8 @@

Remove Method

- Documentation for this section has not yet been entered. -

+ Removes the specified header from the collection. +

Syntax

public void Remove (System.Net.HttpResponseHeader header)

Parameters

@@ -1360,8 +1561,8 @@ header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpResponseHeader to remove from the collection. +

Remarks

@@ -1376,8 +1577,8 @@

Remove Method

- Documentation for this section has not yet been entered. -

+ Removes the specified header from the collection. +

Syntax

public override void Remove (string name)

Parameters

@@ -1387,10 +1588,43 @@ name
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to remove from the collection. +
+

Exceptions

+
+ + + + + + + + + + + + + +
TypeReason
+ ArgumentNullException + + name is null or string.Empty. +
+ ArgumentException + +

+ name contains invalid characters. +

+

+ -or- +

+

+ name is a restricted header name. +

+
+

Remarks

Documentation for this section has not yet been entered. @@ -1403,8 +1637,8 @@

Set Method

- Documentation for this section has not yet been entered. -

+ Sets the specified header to the specified value. +

Syntax

public void Set (System.Net.HttpRequestHeader header, string value)

Parameters

@@ -1414,14 +1648,14 @@ header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpRequestHeader to set. +
value
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to set. +

Remarks

@@ -1436,8 +1670,8 @@

Set Method

- Documentation for this section has not yet been entered. -

+ Sets the specified header to the specified value. +

Syntax

public void Set (System.Net.HttpResponseHeader header, string value)

Parameters

@@ -1447,14 +1681,14 @@ header
- Documentation for this section has not yet been entered. -
+ A System.Net.HttpResponseHeader to set. +
value
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to set. +

Remarks

@@ -1469,8 +1703,8 @@

Set Method

- Documentation for this section has not yet been entered. -

+ Sets the specified header to the specified value. +

Syntax

public override void Set (string name, string value)

Parameters

@@ -1480,16 +1714,57 @@ name
- Documentation for this section has not yet been entered. -
+ A string that contains the name of the header to set. +
value
- Documentation for this section has not yet been entered. -
+ A string that contains the value of the header to set. +
+

Exceptions

+
+ + + + + + + + + + + + + + + + + +
TypeReason
+ ArgumentNullException + + name is null or string.Empty. +
+ ArgumentException + +

+ name or value contain invalid characters. +

+

+ -or- +

+

+ name is a restricted header name. +

+
+ ArgumentOutOfRangeException + + The length of value is greater than 65535. +
+

Remarks

Documentation for this section has not yet been entered. @@ -1502,8 +1777,8 @@

System.Runtime.Serialization.ISerializable.GetObjectData Method

- Documentation for this section has not yet been entered. -

+ Populates the specified System.Runtime.Serialization.SerializationInfo with the data needed to serialize the WebSocketSharp.Net.WebHeaderCollection. +

Syntax

void System.Runtime.Serialization.ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)
@@ -1514,14 +1789,14 @@ serializationInfo
- Documentation for this section has not yet been entered. -
+ A System.Runtime.Serialization.SerializationInfo that holds the serialized object data. +
streamingContext
- Documentation for this section has not yet been entered. -
+ A System.Runtime.Serialization.StreamingContext that specifies the destination for the serialization. +

Remarks

@@ -1536,14 +1811,14 @@

ToByteArray Method

- Documentation for this section has not yet been entered. -

+ Converts the current WebSocketSharp.Net.WebHeaderCollection to an array of byte. +

Syntax

public byte[] ToByteArray ()

Returns

- Documentation for this section has not yet been entered. -
+ An array of byte that receives the converted current WebSocketSharp.Net.WebHeaderCollection. +

Remarks

Documentation for this section has not yet been entered. @@ -1556,14 +1831,14 @@

ToString Method

- Documentation for this section has not yet been entered. -

+ Returns a string that represents the current WebSocketSharp.Net.WebHeaderCollection. +

Syntax

public override string ToString ()

Returns

- Documentation for this section has not yet been entered. -
+ A string that represents the current WebSocketSharp.Net.WebHeaderCollection. +

Remarks

Documentation for this section has not yet been entered. diff --git a/websocket-sharp/doc/html/WebSocketSharp.Net/index.html b/websocket-sharp/doc/html/WebSocketSharp.Net/index.html index 9575703a..65c03d8e 100644 --- a/websocket-sharp/doc/html/WebSocketSharp.Net/index.html +++ b/websocket-sharp/doc/html/WebSocketSharp.Net/index.html @@ -311,8 +311,8 @@ WebHeaderCollection - Documentation for this section has not yet been entered. - + Provides a collection of the HTTP headers associated with a request or response. +
diff --git a/websocket-sharp/doc/html/index.html b/websocket-sharp/doc/html/index.html index 000d2b33..b19790e9 100644 --- a/websocket-sharp/doc/html/index.html +++ b/websocket-sharp/doc/html/index.html @@ -403,8 +403,8 @@ WebHeaderCollection - Documentation for this section has not yet been entered. - + Provides a collection of the HTTP headers associated with a request or response. +

diff --git a/websocket-sharp/doc/mdoc/WebSocketSharp.Net/WebHeaderCollection.xml b/websocket-sharp/doc/mdoc/WebSocketSharp.Net/WebHeaderCollection.xml index 93fe4b2a..f1c79fca 100644 --- a/websocket-sharp/doc/mdoc/WebSocketSharp.Net/WebHeaderCollection.xml +++ b/websocket-sharp/doc/mdoc/WebSocketSharp.Net/WebHeaderCollection.xml @@ -18,7 +18,9 @@ - To be added. + + Provides a collection of the HTTP headers associated with a request or response. + To be added. @@ -28,7 +30,9 @@ Constructor - To be added. + + Initializes a new instance of the class. + To be added. @@ -41,9 +45,16 @@ - To be added. - To be added. - To be added. + + A that holds the serialized object data. + + + A that contains the contextual information about the source or destination. + + + Initializes a new instance of the class + with the specified and . + To be added. @@ -58,9 +69,19 @@ - To be added. - To be added. + + A that contains a header with the name and value separated by a colon (:). + + + Adds the specified to the collection. + To be added. + + is or a . + + + does not contain a colon. + @@ -75,9 +96,15 @@ - To be added. - To be added. - To be added. + + A that contains the name of the request header to add. + + + A that contains the value of the header to add. + + + Adds the specified request with the specified to the collection. + To be added. @@ -93,9 +120,15 @@ - To be added. - To be added. - To be added. + + A that contains the name of the response header to add. + + + A that contains the value of the header to add. + + + Adds the specified response with the specified to the collection. + To be added. @@ -111,10 +144,33 @@ - To be added. - To be added. - To be added. + + A that contains the name of the header to add. + + + A that contains the value of the header to add. + + + Adds a header with the specified and to the collection. + To be added. + + + is or a . + + + -or- + + + is a restricted header that must be set with a property setting. + + + -or- + + + + The length of is greater than 65535. + @@ -129,10 +185,28 @@ - To be added. - To be added. - To be added. + + A that contains the name of the header to add. + + + A that contains the value of the header to add. + + + Adds a header to the collection without checking whether the header is on the restricted header list. + To be added. + + + is , , or + contains invalid characters. + + + -or- + + + contains invalid characters. + + @@ -143,8 +217,12 @@ System.String[] - To be added. - To be added. + + Gets all header names in the collection. + + + An array of that contains all header names in the collection. + To be added. @@ -157,7 +235,9 @@ - To be added. + + Removes all headers from the collection. + To be added. @@ -169,8 +249,12 @@ System.Int32 - To be added. - To be added. + + Gets the number of headers in the collection. + + + An that indicates the number of headers in the collection. + To be added. @@ -185,9 +269,15 @@ - To be added. - To be added. - To be added. + + An that is the zero-based index of the header to get. + + + Get the value of the header with the specified in the collection. + + + A that receives the value of the header. + To be added. @@ -202,9 +292,16 @@ - To be added. - To be added. - To be added. + + A that contains the name of the header to get. + + + Get the value of the header with the specified in the collection. + + + A that receives the value of the header. + if there is no header with in the collection. + To be added. @@ -217,8 +314,13 @@ - To be added. - To be added. + + Gets the enumerator to use to iterate through the . + + + An instance of an implementation of the interface + to use to iterate through the . + To be added. @@ -233,9 +335,15 @@ - To be added. - To be added. - To be added. + + An is the zero-based index of the key to get from the collection. + + + Get the header name at the specified position in the collection. + + + A that receives the header name. + To be added. @@ -251,9 +359,15 @@ - To be added. - To be added. - To be added. + + A that holds the serialized object data. + + + A that specifies the destination for the serialization. + + + Populates the specified with the data needed to serialize the . + To be added. @@ -268,9 +382,15 @@ - To be added. - To be added. - To be added. + + An is the zero-based index of the header in the collection. + + + Gets an array of header values stored in the specified position of the header collection. + + + An array of that receives the header values. + To be added. @@ -285,9 +405,15 @@ - To be added. - To be added. - To be added. + + A that contains a header name. + + + Gets an array of header values stored in the specified name. + + + An array of that receives the header values. + To be added. @@ -302,10 +428,22 @@ - To be added. - To be added. - To be added. + + A that contains the name of the header to test. + + + Determines whether the specified header can be set for the request. + + + true if the header is restricted; otherwise, false. + To be added. + + is or . + + + contains invalid characters. + @@ -320,44 +458,70 @@ - To be added. - To be added. - To be added. - To be added. + + A that contains the name of the header to test. + + + true if does the test for the response; for the request, false. + + + Determines whether the specified header can be set for the request or the response. + + + true if the header is restricted; otherwise, false. + To be added. + + is or . + + + contains invalid characters. + - + Property System.String - + - To be added. - To be added. - To be added. + + A that contains a request header name. + + + Gets or sets the specified request in the collection. + + + A that contains the value of the specified request . + To be added. - + Property System.String - + - To be added. - To be added. - To be added. + + A that contains a response header name. + + + Gets or sets the specified response in the collection. + + + A that contains the value of the specified response . + To be added. @@ -369,8 +533,12 @@ System.Collections.Specialized.NameObjectCollectionBase+KeysCollection - To be added. - To be added. + + Gets a collection of header names in the collection. + + + A that contains a collection of header names in the collection. + To be added. @@ -385,8 +553,13 @@ - To be added. - To be added. + + An that contains the source of the deserialization event. + + + Implements the interface and raises the deserialization event + when the deserialization is complete. + To be added. @@ -401,8 +574,12 @@ - To be added. - To be added. + + A to remove from the collection. + + + Removes the specified header from the collection. + To be added. @@ -417,8 +594,12 @@ - To be added. - To be added. + + A to remove from the collection. + + + Removes the specified header from the collection. + To be added. @@ -433,9 +614,27 @@ - To be added. - To be added. + + A that contains the name of the header to remove from the collection. + + + Removes the specified header from the collection. + To be added. + + is or . + + + + contains invalid characters. + + + -or- + + + is a restricted header name. + + @@ -450,9 +649,15 @@ - To be added. - To be added. - To be added. + + A to set. + + + A that contains the value of the header to set. + + + Sets the specified header to the specified value. + To be added. @@ -468,9 +673,15 @@ - To be added. - To be added. - To be added. + + A to set. + + + A that contains the value of the header to set. + + + Sets the specified header to the specified value. + To be added. @@ -486,10 +697,33 @@ - To be added. - To be added. - To be added. + + A that contains the name of the header to set. + + + A that contains the value of the header to set. + + + Sets the specified header to the specified value. + To be added. + + is or . + + + + or contain invalid characters. + + + -or- + + + is a restricted header name. + + + + The length of is greater than 65535. + @@ -504,9 +738,15 @@ - To be added. - To be added. - To be added. + + A that holds the serialized object data. + + + A that specifies the destination for the serialization. + + + Populates the specified with the data needed to serialize the . + To be added. @@ -519,8 +759,12 @@ - To be added. - To be added. + + Converts the current to an array of . + + + An array of that receives the converted current . + To be added. @@ -533,8 +777,12 @@ - To be added. - To be added. + + Returns a that represents the current . + + + A that represents the current . + To be added. diff --git a/websocket-sharp/doc/mdoc/index.xml b/websocket-sharp/doc/mdoc/index.xml index c44513c3..e1c2c511 100644 --- a/websocket-sharp/doc/mdoc/index.xml +++ b/websocket-sharp/doc/mdoc/index.xml @@ -1,6 +1,6 @@ - + [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 11 00 00 00 29 17 fb 89 fe c3 91 f7 2b cb 8b e2 61 d2 3f 05 93 6d 65 a8 9e 63 72 a6 f5 d5 2c f2 9d 20 fa 0b c0 70 6a f6 88 7e 8b 90 3f 39 f5 76 c8 48 e0 bb 7b b2 7b ed d3 10 a7 1a 0f 70 98 0f 7f f4 4b 53 09 d2 a5 ef 36 c3 56 b4 aa f0 91 72 63 25 07 89 e0 93 3e 3f 2e f2 b9 73 0e 12 15 5d 43 56 c3 f4 70 a5 89 fe f7 f6 ac 3e 77 c2 d8 d0 84 91 f4 0c d1 f3 8e dc c3 c3 b8 38 3d 0c bf 17 de 20 78 c1 ] diff --git a/websocket-sharp/websocket-sharp.pidb b/websocket-sharp/websocket-sharp.pidb index 7f7d2aab..48ac9369 100644 Binary files a/websocket-sharp/websocket-sharp.pidb and b/websocket-sharp/websocket-sharp.pidb differ