ASP.NET Headers Collection Supports Multiple Same Field Names

IETF RFC allows multiple headers to be requested with the same field name while maintaining order and values ​​can be converted to a single comma-separated list of values ​​header

http://tools.ietf.org/html/rfc2616#section-4.2

Multiple message header fields with the same field name MAY be able to be present in a message if and only if the entire field value for that header field is specified as a comma-separated list [i.e. # (values)].
It MUST be able to combine multiple header fields into one Parameter "field-name: field-value" without changing the semantics of the message, adding each subsequent field value to the first, each separated by a comma. The order in which the header fields are the same so the field name is meaningful to the interpretation of the combined field value, and therefore the proxy MUST NOT change the order of these field values ​​when sending the message.

How does ASP.NET handle having multiple headers with the same name?

HttpContext.Current.Request.Headers[]

      

Headers[]

is it System.Collection.Specialized.NameValueCollection

, which is a set of key-value pairs, where the value can actually be a set of values.

But it is unclear how multiple values ​​from request headers are decompressed: is the collection built by parsing a single comma-separated value? or is it deconstructed from a collection of one or more headers of the same field name?

+3


source to share





All Articles