[Web-SIG] SERVER_PORT and Unix sockets

Randy Syring rsyring at gmail.com
Mon Jan 2 16:09:52 CET 2012


I'm sure you've read this:

http://www.python.org/dev/peps/pep-0333/#environ-variables

    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.

    <...snip...>
    SERVER_NAME, SERVER_PORT
         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.

-------------------------------------
Randy Syring
Intelicom |Level 12  <http://inteli-com.com/index.html#level12>
Direct: 502-276-0459
Office: 502-212-9913

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:
> 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
> _______________________________________________
> Web-SIG mailing list
> Web-SIG at python.org
> Web SIG: http://www.python.org/sigs/web-sig
> Unsubscribe: 
> http://mail.python.org/mailman/options/web-sig/rsyring%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/web-sig/attachments/20120102/619c971c/attachment.html>


More information about the Web-SIG mailing list