[Web-SIG] Multiple message-header fields handling

Manlio Perillo manlio_perillo at libero.it
Tue Oct 2 21:30:46 CEST 2007

The HTTP 1.1 protocol (section 4.2) says that:
"""Multiple message-header fields with the same field-name MAY be 
present in a message if and only if the entire field-value for that 
header field is defined as a comma-separated list [i.e., #(values)]."""

This can happen, as an example, with the Cookie header.

My question is: how should this be handled in WSGI?

As an example Nginx stores all the headers in a associative array, 
where, of course, only the "last seen" headers appears.

However common multiple message-headers are stored in the request struct.

Since the WSGI environment is a dictionary with keys and values of type 
str, should an implementation:
"""combine the multiple header fields into one "field-name: field-value" 
pair, without changing the semantics of the message, by appending each 
subsequent field-value to the first, each separated by a comma."""

Ngins does not do this (and I don't know what Apache does).

Another question: when an header has an empty field value, what should 
be set in the environment: an empty string or None?

Thanks  Manlio Perillo

More information about the Web-SIG mailing list