Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does wsgi handle multiple request headers with the same name?

Tags:

python

http

wsgi

In WSGI headers are represented in the environ as 'HTTP_XXX' values. For example the value Cookie: header is stored at the HTTP_COOKIE key of the environ.

How are multiple request headers with the same header name represented?

like image 359
Stef Avatar asked Nov 26 '09 01:11

Stef


People also ask

Can you have multiple HTTP headers with the same name?

A recipient MAY combine multiple header fields with the same field name into one field-name: field-value pair, without changing the semantics of the message, by appending each subsequent field value to the combined field value in order, separated by a comma.

Can a HTTP request have multiple headers?

The HTTP Headers can have one or more values depending on the header field definitions. A multi-valued header will have comma separated values.


1 Answers

Multiple cookies are combined into a single header, separated by semicolons.

Multiple headers are allowed by the HTTP spec, but only for certain kinds of headers, and it is always permissible to combine those headers into one (though using commas, not semicolons)

like image 183
inklesspen Avatar answered Oct 22 '22 03:10

inklesspen