[Web-SIG] SERVER_PORT and Unix sockets

Benoit Chesneau bchesneau at gmail.com
Mon Feb 20 18:51:34 CET 2012

On Mon, Jan 2, 2012 at 3:59 PM, Jonas H. <jonas at lophus.org> wrote:
> 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.
> Jonas

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?

- benoit

More information about the Web-SIG mailing list