AddKnownHeaders() static private method

static private AddKnownHeaders ( HashSet headerSet ) : void
headerSet HashSet
return void
Exemplo n.º 1
0
        static HttpRequestHeaders()
        {
            parserStore = new Dictionary <string, HttpHeaderParser>(StringComparer.OrdinalIgnoreCase);

            parserStore.Add(HttpKnownHeaderNames.Accept, MediaTypeHeaderParser.MultipleValuesParser);
            parserStore.Add(HttpKnownHeaderNames.AcceptCharset, GenericHeaderParser.MultipleValueStringWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.AcceptEncoding, GenericHeaderParser.MultipleValueStringWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.AcceptLanguage, GenericHeaderParser.MultipleValueStringWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.Authorization, GenericHeaderParser.SingleValueAuthenticationParser);
            parserStore.Add(HttpKnownHeaderNames.Expect, GenericHeaderParser.MultipleValueNameValueWithParametersParser);
            parserStore.Add(HttpKnownHeaderNames.From, GenericHeaderParser.MailAddressParser);
            parserStore.Add(HttpKnownHeaderNames.Host, GenericHeaderParser.HostParser);
            parserStore.Add(HttpKnownHeaderNames.IfMatch, GenericHeaderParser.MultipleValueEntityTagParser);
            parserStore.Add(HttpKnownHeaderNames.IfModifiedSince, DateHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.IfNoneMatch, GenericHeaderParser.MultipleValueEntityTagParser);
            parserStore.Add(HttpKnownHeaderNames.IfRange, GenericHeaderParser.RangeConditionParser);
            parserStore.Add(HttpKnownHeaderNames.IfUnmodifiedSince, DateHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.MaxForwards, Int32NumberHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.ProxyAuthorization, GenericHeaderParser.SingleValueAuthenticationParser);
            parserStore.Add(HttpKnownHeaderNames.Range, GenericHeaderParser.RangeParser);
            parserStore.Add(HttpKnownHeaderNames.Referer, UriHeaderParser.RelativeOrAbsoluteUriParser);
            parserStore.Add(HttpKnownHeaderNames.TE, TransferCodingHeaderParser.MultipleValueWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.UserAgent, ProductInfoHeaderParser.MultipleValueParser);

            HttpGeneralHeaders.AddParsers(parserStore);

            invalidHeaders = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            HttpContentHeaders.AddKnownHeaders(invalidHeaders);
            // Note: Reserved response header names are allowed as custom request header names.  Reserved response
            // headers have no defined meaning or format when used on a request.  This enables a server to accept
            // any headers sent from the client as either content headers or request headers.
        }
Exemplo n.º 2
0
        static HttpRequestHeaders()
        {
            parserStore = new Dictionary <string, HttpHeaderParser>(HeaderUtilities.CaseInsensitiveStringComparer);

            parserStore.Add(HttpKnownHeaderNames.Accept, MediaTypeHeaderParser.MultipleValuesParser);
            parserStore.Add(HttpKnownHeaderNames.AcceptCharset, GenericHeaderParser.StringWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.AcceptEncoding, GenericHeaderParser.StringWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.AcceptLanguage, GenericHeaderParser.StringWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.Authorization, GenericHeaderParser.SingleValueAuthenticationParser);
            parserStore.Add(HttpKnownHeaderNames.Expect, GenericHeaderParser.NameValueWithParametersParser);
            parserStore.Add(HttpKnownHeaderNames.From, GenericHeaderParser.MailAddressParser);
            parserStore.Add(HttpKnownHeaderNames.Host, GenericHeaderParser.HostParser);
            parserStore.Add(HttpKnownHeaderNames.IfMatch, GenericHeaderParser.MultipleValueEntityTagParser);
            parserStore.Add(HttpKnownHeaderNames.IfModifiedSince, DateHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.IfNoneMatch, GenericHeaderParser.MultipleValueEntityTagParser);
            parserStore.Add(HttpKnownHeaderNames.IfRange, GenericHeaderParser.RangeConditionParser);
            parserStore.Add(HttpKnownHeaderNames.IfUnmodifiedSince, DateHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.MaxForwards, Int32NumberHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.ProxyAuthorization, GenericHeaderParser.SingleValueAuthenticationParser);
            parserStore.Add(HttpKnownHeaderNames.Range, GenericHeaderParser.RangeParser);
            parserStore.Add(HttpKnownHeaderNames.Referer, UriHeaderParser.RelativeOrAbsoluteUriParser);
            parserStore.Add(HttpKnownHeaderNames.TE, TransferCodingHeaderParser.ValueWithQualityParser);
            parserStore.Add(HttpKnownHeaderNames.UserAgent, ProductInfoHeaderParser.Parser);

            HttpGeneralHeaders.AddParsers(parserStore);

            invalidHeaders = new HashSet <string>(HeaderUtilities.CaseInsensitiveStringComparer);
            HttpResponseHeaders.AddKnownHeaders(invalidHeaders);
            HttpContentHeaders.AddKnownHeaders(invalidHeaders);
        }
Exemplo n.º 3
0
        private static HashSet <string> CreateInvalidHeaders()
        {
            var invalidHeaders = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            HttpContentHeaders.AddKnownHeaders(invalidHeaders);
            return(invalidHeaders);

            // Note: Reserved request header names are allowed as custom response header names.  Reserved request
            // headers have no defined meaning or format when used on a response. This enables a client to accept
            // any headers sent from the server as either content headers or response headers.
        }
Exemplo n.º 4
0
        static HttpResponseHeaders()
        {
            s_parserStore = new Dictionary <string, HttpHeaderParser>(StringComparer.OrdinalIgnoreCase);

            s_parserStore.Add(HttpKnownHeaderNames.AcceptRanges, GenericHeaderParser.TokenListParser);
            s_parserStore.Add(HttpKnownHeaderNames.Age, TimeSpanHeaderParser.Parser);
            s_parserStore.Add(HttpKnownHeaderNames.ETag, GenericHeaderParser.SingleValueEntityTagParser);
            s_parserStore.Add(HttpKnownHeaderNames.Location, UriHeaderParser.RelativeOrAbsoluteUriParser);
            s_parserStore.Add(HttpKnownHeaderNames.ProxyAuthenticate, GenericHeaderParser.MultipleValueAuthenticationParser);
            s_parserStore.Add(HttpKnownHeaderNames.RetryAfter, GenericHeaderParser.RetryConditionParser);
            s_parserStore.Add(HttpKnownHeaderNames.Server, ProductInfoHeaderParser.MultipleValueParser);
            s_parserStore.Add(HttpKnownHeaderNames.Vary, GenericHeaderParser.TokenListParser);
            s_parserStore.Add(HttpKnownHeaderNames.WWWAuthenticate, GenericHeaderParser.MultipleValueAuthenticationParser);

            HttpGeneralHeaders.AddParsers(s_parserStore);

            s_invalidHeaders = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            HttpContentHeaders.AddKnownHeaders(s_invalidHeaders);
            // Note: Reserved request header names are allowed as custom response header names.  Reserved request
            // headers have no defined meaning or format when used on a response. This enables a client to accept
            // any headers sent from the server as either content headers or response headers.
        }
Exemplo n.º 5
0
        static HttpResponseHeaders()
        {
            parserStore = new Dictionary <string, HttpHeaderParser>(HeaderUtilities.CaseInsensitiveStringComparer);

            parserStore.Add(HttpKnownHeaderNames.AcceptRanges, GenericHeaderParser.TokenListParser);
            parserStore.Add(HttpKnownHeaderNames.Age, TimeSpanHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.ETag, GenericHeaderParser.SingleValueEntityTagParser);
            // The RFC says that the Location header should be an absolute Uri,
            // but IIS and HttpListener do not enforce this.
            parserStore.Add(HttpKnownHeaderNames.Location, UriHeaderParser.RelativeOrAbsoluteUriParser);
            parserStore.Add(HttpKnownHeaderNames.ProxyAuthenticate, GenericHeaderParser.MultipleValueAuthenticationParser);
            parserStore.Add(HttpKnownHeaderNames.RetryAfter, GenericHeaderParser.RetryConditionParser);
            parserStore.Add(HttpKnownHeaderNames.Server, ProductInfoHeaderParser.Parser);
            parserStore.Add(HttpKnownHeaderNames.Vary, GenericHeaderParser.TokenListParser);
            parserStore.Add(HttpKnownHeaderNames.WWWAuthenticate, GenericHeaderParser.MultipleValueAuthenticationParser);

            HttpGeneralHeaders.AddParsers(parserStore);

            invalidHeaders = new HashSet <string>(HeaderUtilities.CaseInsensitiveStringComparer);
            HttpRequestHeaders.AddKnownHeaders(invalidHeaders);
            HttpContentHeaders.AddKnownHeaders(invalidHeaders);
        }