Documenting ssl servers.

This commit is contained in:
Ryan Williams
2010-09-17 01:47:53 -07:00
parent dc70cc3812
commit 323bfcc1fe
3 changed files with 25 additions and 11 deletions

View File

@@ -22,9 +22,10 @@ To create a websocket server, simply decorate a handler method with
You can find a slightly more elaborate version of this code in the file
``examples/websocket.py``.
**Note** that the web socket spec is still under development, and it
will be necessary to change the way that this module works in response
to spec changes.
As of version 0.9.13, eventlet.websocket supports SSL websockets; all that's necessary is to use an :ref:`SSL wsgi server <wsgi_ssl>`.
.. note :: The web socket spec is still under development, and it will be necessary to change the way that this module works in response to spec changes.
.. automodule:: eventlet.websocket
:members:

View File

@@ -1,7 +1,7 @@
:mod:`wsgi` -- WSGI server
===========================
The wsgi module provides a simple an easy way to start an event-driven
The wsgi module provides a simple and easy way to start an event-driven
`WSGI <http://wsgi.org/wsgi/>`_ server. This can serve as an embedded
web server in an application, or as the basis for a more full-featured web
server package. One such package is `Spawning <http://pypi.python.org/pypi/Spawning/>`_.
@@ -21,6 +21,25 @@ To launch a wsgi server, simply create a socket and call :func:`eventlet.wsgi.se
You can find a slightly more elaborate version of this code in the file
``examples/wsgi.py``.
.. automodule:: eventlet.wsgi
:members:
.. _wsgi_ssl:
SSL
---
Creating a secure server is only slightly more involved than the base example. All that's needed is to pass an SSL-wrapped socket to the :func:`~eventlet.wsgi.server` method::
wsgi.server(eventlet.wrap_ssl(eventlet.listen(('', 8090)),
certfile='cert.crt',
keyfile='private.key',
server_side=True),
hello_world)
Applications can detect whether they are inside a secure server by the value of the ``env['wsgi.url_scheme']`` environment variable.
Non-Standard Extension to Support Post Hooks
--------------------------------------------
Eventlet's WSGI server supports a non-standard extension to the WSGI
@@ -53,9 +72,3 @@ Post hooks are useful when code needs to be executed after a response has been
fully sent to the client (or when the client disconnects early). One example is
for more accurate logging of bandwidth used, as client disconnects use less
bandwidth than the actual Content-Length.
API
---
.. automodule:: eventlet.wsgi
:members:

View File

@@ -551,7 +551,7 @@ def server(sock, site,
:param log_x_forwarded_for: If True (the default), logs the contents of the x-forwarded-for header in addition to the actual client ip address in the 'client_ip' field of the log line.
:param custom_pool: A custom GreenPool instance which is used to spawn client green threads. If this is supplied, max_size is ignored.
:param keepalive: If set to False, disables keepalives on the server; all connections will be closed after serving one request.
:param log_format: A python format string that is used as the template to generate log lines. The following values can be formatted into it: client_ip, date_time, request_line, status_code, body_length, wall_seconds. Look the default for an example of how to use this.
:param log_format: A python format string that is used as the template to generate log lines. The following values can be formatted into it: client_ip, date_time, request_line, status_code, body_length, wall_seconds. The default is a good example of how to use it.
"""
serv = Server(sock, sock.getsockname(),
site, log,