[Web-SIG] Multiple message-header fields handling

Manlio Perillo manlio_perillo at libero.it
Tue Oct 2 22:11:40 CEST 2007

Phillip J. Eby ha scritto:
> At 09:30 PM 10/2/2007 +0200, Manlio Perillo wrote:
>> 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."""
>> ?
> If that's the only way to make the headers work, then the server may do so.

Nginx does not combine headers, so I have to do it by myself (and this 
will complicate the implementation)...

However IMHO here you should not use the word "may", but "must", and 
this should be explicitly stated in the WSGI spec.

 > [...]

Thanks and regards   Manlio Perillo

More information about the Web-SIG mailing list