UnityEngine.WWW.CheckSecurityOnHeaders C# (CSharp) Method

CheckSecurityOnHeaders() private static method

private static CheckSecurityOnHeaders ( string headers ) : void
headers string
return void
        private static void CheckSecurityOnHeaders(string[] headers)
        {
            for (int i = 0; i < headers.Length; i += 2)
            {
                foreach (string str in forbiddenHeaderKeys)
                {
                    if (string.Equals(headers[i], str, StringComparison.CurrentCultureIgnoreCase))
                    {
                        throw new ArgumentException("Cannot overwrite header: " + headers[i]);
                    }
                }
                if (headers[i].StartsWith("Sec-") || headers[i].StartsWith("Proxy-"))
                {
                    throw new ArgumentException("Cannot overwrite header: " + headers[i]);
                }
                if (((headers[i].IndexOfAny(forbiddenCharacters) > -1) || (headers[i].IndexOfAny(forbiddenCharactersForNames) > -1)) || (headers[i + 1].IndexOfAny(forbiddenCharacters) > -1))
                {
                    throw new ArgumentException("Cannot include control characters in a HTTP header, either as key or value.");
                }
            }
        }

Usage Example

コード例 #1
0
 public WWW(string url, byte[] postData, Dictionary <string, string> headers)
 {
     string[] array = WWW.FlattenedHeadersFrom(headers);
     if (this.enforceWebSecurityRestrictions())
     {
         WWW.CheckSecurityOnHeaders(array);
     }
     this.InitWWW(url, postData, array);
 }
All Usage Examples Of UnityEngine.WWW::CheckSecurityOnHeaders