Package web2py :: Package gluon :: Module wsgiserver :: Class CherryPyWSGIServer
[hide private]
[frames] | no frames]

Class CherryPyWSGIServer

source code

object --+
         |
        CherryPyWSGIServer

An HTTP server for WSGI.

bind_addr: The interface on which to listen for connections.
    For TCP sockets, a (host, port) tuple. Host values may be any IPv4
    or IPv6 address, or any valid hostname. The string 'localhost' is a
    synonym for '127.0.0.1' (or '::1', if your hosts file prefers IPv6).
    The string '0.0.0.0' is a special IPv4 entry meaning "any active
    interface" (INADDR_ANY), and '::' is the similar IN6ADDR_ANY for
    IPv6. The empty string or None are not allowed.

    For UNIX sockets, supply the filename as a string.
wsgi_app: the WSGI 'application callable'; multiple WSGI applications
    may be passed as (path_prefix, app) pairs.
numthreads: the number of worker threads to create (default 10).
server_name: the string to set for WSGI's SERVER_NAME environ entry.
    Defaults to socket.gethostname().
max: the maximum number of queued requests (defaults to -1 = no limit).
request_queue_size: the 'backlog' argument to socket.listen();
    specifies the maximum number of queued connections (default 5).
timeout: the timeout in seconds for accepted connections (default 10).

nodelay: if True (the default since 3.1), sets the TCP_NODELAY socket
    option.

protocol: the version string to write in the Status-Line of all
    HTTP responses. For example, "HTTP/1.1" (the default). This
    also limits the supported features used in the response.


SSL/HTTPS
---------
You must have an ssl library installed and set self.ssl_adapter to an
instance of SSLAdapter (or a subclass) which provides the methods:
    wrap(sock) -> wrapped socket, ssl environ dict
    makefile(sock, mode='r', bufsize=-1) -> socket file object

Nested Classes [hide private]
  ConnectionClass
An HTTP connection (active socket).
Instance Methods [hide private]
 
__init__(self, bind_addr, wsgi_app, numthreads=10, server_name=None, max=-1, request_queue_size=5, timeout=10, shutdown_timeout=5)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_get_numthreads(self) source code
 
_set_numthreads(self, value) source code
 
__str__(self)
str(x)
source code
 
_get_bind_addr(self) source code
 
_set_bind_addr(self, value) source code
 
start(self)
Run the server forever.
source code
 
bind(self, family, type, proto=0)
Create (or recreate) the actual socket object.
source code
 
tick(self)
Accept a new connection and put it on the Queue.
source code
 
_get_interrupt(self) source code
 
_set_interrupt(self, interrupt) source code
 
stop(self)
Gracefully shutdown a server that is serving forever.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Class Variables [hide private]
  protocol = 'HTTP/1.1'
  _bind_addr = '127.0.0.1'
  version = 'CherryPy/3.2.0beta'
  ready = False
  _interrupt = None
  nodelay = True
  environ = {'wsgi.version': (1, 0)}
  ssl_adapter = None
Properties [hide private]
  numthreads
  bind_addr
The interface on which to listen for connections.
  interrupt
Set this to an Exception instance to interrupt the server.

Inherited from object: __class__

Method Details [hide private]

__init__(self, bind_addr, wsgi_app, numthreads=10, server_name=None, max=-1, request_queue_size=5, timeout=10, shutdown_timeout=5)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

Property Details [hide private]

numthreads

Get Method:
_get_numthreads(self)
Set Method:
_set_numthreads(self, value)

bind_addr

The interface on which to listen for connections.

For TCP sockets, a (host, port) tuple. Host values may be any IPv4 or IPv6 address, or any valid hostname. The string 'localhost' is a synonym for '127.0.0.1' (or '::1', if your hosts file prefers IPv6). The string '0.0.0.0' is a special IPv4 entry meaning "any active interface" (INADDR_ANY), and '::' is the similar IN6ADDR_ANY for IPv6. The empty string or None are not allowed.

For UNIX sockets, supply the filename as a string.

Get Method:
_get_bind_addr(self)
Set Method:
_set_bind_addr(self, value)

interrupt

Set this to an Exception instance to interrupt the server.

Get Method:
_get_interrupt(self)
Set Method:
_set_interrupt(self, interrupt)