コード例 #1
0
        private static void AddHeaderValues(WebHeaderCollection source, int index, string header, HttpHeaders destination)
        {
            string[] values = source.GetValues(index);

            // Even though AddWithoutValidation() could throw FormatException for header values containing newline
            // chars that are not followed by whitespace chars, we don't need to catch that exception. Our header
            // values were returned by HttpWebResponse which is trusted to only return valid header values.
            if (values.Length == 1)
            {
                destination.AddWithoutValidation(header, values[0]);
            }
            else
            {
                for (int j = 0; j < values.Length; j++)
                {
                    destination.AddWithoutValidation(header, values[j]);
                }
            }
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: N3X15/mono
 public static bool TryAddWithoutValidation(this HttpHeaders headers, string key, IEnumerable <string> values)
 {
     headers.AddWithoutValidation(key, values);
     return(true);
 }
コード例 #3
0
ファイル: HttpClientChannel.cs プロジェクト: nuxleus/WCFWeb
        private static void AddHeaderValues(WebHeaderCollection source, int index, string header, HttpHeaders destination)
        {
            string[] values = source.GetValues(index);

            // Even though AddWithoutValidation() could throw FormatException for header values containing newline
            // chars that are not followed by whitespace chars, we don't need to catch that exception. Our header
            // values were returned by HttpWebResponse which is trusted to only return valid header values.
            if (values.Length == 1)
            {
                destination.AddWithoutValidation(header, values[0]);
            }
            else
            {
                for (int j = 0; j < values.Length; j++)
                {
                    destination.AddWithoutValidation(header, values[j]);
                }
            }
        }
コード例 #4
0
ファイル: Extensions.cs プロジェクト: N3X15/mono
 public static void TryAddWithoutValidation(this HttpHeaders headers, string key, string value)
 {
     headers.AddWithoutValidation(key, value);
 }