[webkit-dev] Why is HTTPHeaderMap a map instead of multi-map?

Darin Adler darin at apple.com
Mon Feb 23 14:46:50 PST 2009

On Feb 14, 2009, at 11:41 AM, Paul Pedriana wrote:

> Given that HTTP header fields can have the same header represented  
> more than once, why is it that HTTPHeaderMap is a map and not a  
> multi-map?

When there are multiple HTTP header fields with the same field name,  
it’s just shorthand for a comma-separated list (see <http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 
 >). So logically there really is only one value for each field name.

> How would you send a ResourceRequest that has two headers of the  
> same name to an HTTP server?

I’m not sure what piece of code “you” is here. Are you asking about  
the behavior of XMLHttpRequest?

There’s a related issue with the order of header fields. Using a map  
for header field values means it’s up to the networking layer to order  
the header fields.

     -- Darin

More information about the webkit-dev mailing list