Pheonix-waitress

Latest version: v2.1.1.2

Safety actively analyzes 641102 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 7

0.8

----------------

Features
~~~~~~~~

- Support the WSGI ``wsgi.file_wrapper`` protocol as per
https://www.python.org/dev/peps/pep-0333/#optional-platform-specific-file-handling.
Here's a usage example::

import os

here = os.path.dirname(os.path.abspath(__file__))

def myapp(environ, start_response):
f = open(os.path.join(here, 'myphoto.jpg'), 'rb')
headers = [('Content-Type', 'image/jpeg')]
start_response(
'200 OK',
headers
)
return environ['wsgi.file_wrapper'](f, 32768)

The signature of the file wrapper constructor is ``(filelike_object,
block_size)``. Both arguments must be passed as positional (not keyword)
arguments. The result of creating a file wrapper should be **returned** as
the ``app_iter`` from a WSGI application.

The object passed as ``filelike_object`` to the wrapper must be a file-like
object which supports *at least* the ``read()`` method, and the ``read()``
method must support an optional size hint argument. It *should* support
the ``seek()`` and ``tell()`` methods. If it does not, normal iteration
over the filelike object using the provided block_size is used (and copying
is done, negating any benefit of the file wrapper). It *should* support a
``close()`` method.

The specified ``block_size`` argument to the file wrapper constructor will
be used only when the ``filelike_object`` doesn't support ``seek`` and/or
``tell`` methods. Waitress needs to use normal iteration to serve the file
in this degenerate case (as per the WSGI spec), and this block size will be
used as the iteration chunk size. The ``block_size`` argument is optional;
if it is not passed, a default value``32768`` is used.

Waitress will set a ``Content-Length`` header on the behalf of an
application when a file wrapper with a sufficiently filelike object is used
if the application hasn't already set one.

The machinery which handles a file wrapper currently doesn't do anything
particularly special using fancy system calls (it doesn't use ``sendfile``
for example); using it currently just prevents the system from needing to
copy data to a temporary buffer in order to send it to the client. No
copying of data is done when a WSGI app returns a file wrapper that wraps a
sufficiently filelike object. It may do something fancier in the future.

0.7

----------------

Features
~~~~~~~~

- Default ``send_bytes`` value is now 18000 instead of 9000. The larger
default value prevents asyncore from needing to execute select so many
times to serve large files, speeding up file serving by about 15%-20% or
so. This is probably only an optimization for LAN communications, and
could slow things down across a WAN (due to higher TCP overhead), but we're
likely to be behind a reverse proxy on a LAN anyway if in production.

- Added an (undocumented) profiling feature to the ``serve()`` command.

0.6.1

------------------

Bug Fixes
~~~~~~~~~

- Remove performance-sapping call to ``pull_trigger`` in the channel's
``write_soon`` method added mistakenly in 0.6.

0.6

----------------

Bug Fixes
~~~~~~~~~

- A logic error prevented the internal outbuf buffer of a channel from being
flushed when the client could not accept the entire contents of the output
buffer in a single succession of socket.send calls when the channel was in
a "pending close" state. The socket in such a case would be closed
prematurely, sometimes resulting in partially delivered content. This was
discovered by a user using waitress behind an Nginx reverse proxy, which
apparently is not always ready to receive data. The symptom was that he
received "half" of a large CSS file (110K) while serving content via
waitress behind the proxy.

0.5

----------------

Bug Fixes
~~~~~~~~~

- Fix PATH_INFO encoding/decoding on Python 3 (as per PEP 3333, tunnel
bytes-in-unicode-as-latin-1-after-unquoting).

0.4

----------------

Features
~~~~~~~~

- Added "design" document to docs.

Bug Fixes
~~~~~~~~~

- Set default ``connection_limit`` back to 100 for benefit of maximal
platform compatibility.

- Normalize setting of ``last_activity`` during send.

- Minor resource cleanups during tests.

- Channel timeout cleanup was broken.

Page 6 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.