On Wed, 15 Oct 2014 09:22:28 +1300
Robert Collins
<robe...@robertcollins.net> wrote:
> >
> > You may have misunderstood me. I am talking about the Transport and
> > Protocol abstractions defined in PEP 3156.
> 
> Lets assume I did. Given say nginx + uwsgi + asyncio, you're proposing
> that there be a uwsgi-asyncio module that listens to the uwsgi socket
> and demuxes packets from that into something that then exposes a
> ReadTransport + WriteTransport pair and a Protocol on top of that.

Let's call it uwsgi-pep3156. It shouldn't be asyncio-specific.

[Note Guido's original remark: """However, the situation is different
for reading the request body. The app can read this in dribs and drabs
if it wants to, by reading limited amounts of data from
environ['wsgi.input'], but in an asyncio-driven world reading
operations should really be marked with "yield from" (or perhaps just
yield -- again, I'm sure an adaptor won't have a problem with this)."""

Ergo, this is about streaming the request and response bodies. Not
asynchronously receiving the headers, etc.]


The server would implement a Transport for the input body stream +
output body stream. It would accept a Protocol factory from the
application/middleware.

Then when a request comes:

   protocol = protocol_factory()
   transport = Transport(...)
   protocol.connection_made(transport)

and when an input body chunk is available:

   protocol.data_received(chunk)

and when the input body is finished:

   protocol.eof_received()

The protocol would be able to call transport.extra_info(...) to get
HTTP-specific information, e.g. transport.extra_info('headers') perhaps.


(that's for the HTTP part; a websockets layer would probably implement
a separate transport and accept a separate protocol factory; actually,
it could be implemented as a protocol that would parse the websockets
protocol and provide its own transport on top of that... there may
already be such a thing on the Internet :-))

Regards

Antoine.


_______________________________________________
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
https://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com

Reply via email to