The following variables must be present, unless their
value would be an empty string, in which case they may be omitted,
except as otherwise noted below.
When combined with SCRIPT_NAME and PATH_INFO, these variables
can be used to complete the URL. Note, however, that HTTP_HOST, if
present, should be used in preference to SERVER_NAME for
reconstructing the request URL. See the URL Reconstruction section
below for more detail. SERVER_NAME and SERVER_PORT can never
be empty strings, and so are always required.
So, it sounds to me like the spec doesn't take unix sockets into
consideration, which makes sense. Either way, if you omit, or set
the value to an empty string, you are going to be violating the
spec. FWIW, if it was me, I'd follow suit with what the other
servers are doing.
Intelicom | Level 12
For the wages of sin is death, but the free gift of God
is eternal life in Christ Jesus our Lord (Rom 6:23)
On 01/02/2012 09:59 AM, Jonas H. wrote:
What is SERVER_PORT supposed to be set to if the WSGI server is
only bound to a Unix socket?
Some major Web servers (Gunicorn, CherryPy) set it to the empty
string. Intuitively I'd rather not set it at all.
> Hello everyone!
> What is SERVER_PORT supposed to be set to if the WSGI server is only bound
> to a Unix socket?
> Some major Web servers (Gunicorn, CherryPy) set it to the empty string.
> Intuitively I'd rather not set it at all.
> What do you guys recommend?
> btw, www.wsgi.org != wsgi.org. That's very confusing.
Mmm are you sure it's empty in gunicorn?
For the server addres we are using socket.getsockname() for the
default so at this step the port can be null, but then Host header
(HTTP_HOST) which override the defaults. We are following the spec on
that's matter. So I'm surprised that port can be empty. Can you
provide an example I could reproduce?