-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataQueue is missing the read(n) method (and some others) #81
Comments
Well, aiohttp is not fully wsgi compliant server and it won't. Wsgi spec doesn't say anything about asyncio coroutines. It is possible to make it compliant with readpayload=true parameter, but this is not for production, it reads payload into memory |
I thought it is compatible with pep-3156? But it isn't.
|
Ah, sorry. I thought about wsgi specs. Intention for DataQueue is different from StreamReader. You can wrap payload into StreamReader very easily. |
Regarding compatibility with pep-3156, it says nothing about http. That was one of the reasons why we moved http code from asyncio to separate project. |
I could, but if I wrap them I would need to write my own program. Also PEP-3156 says something about http.
It is an Interface and Interfaces should be implemented in my eyes. But who cares. |
gjango will fail horribly, because it is doesn't work with asyncio. Asyncio doesn't work like gevent, you can not just install aiohttp and make your application asynchronous. For non trivial application you have to rewrite it to use asyncio. I don't understated "Interface" part of your comment. Could you elaborate. |
Won't fix |
@fafhrd91 not sure but why a buffered stream reader could not be used there? if buffer is empty or < n it could eventually claim for more data until eof. |
DataQueue is not a bytes stream, it just holds arbitrary objects that parser emits. for example WebSocketParser emits aiohttp.websocket.Message named tuples. if application requires it is very easy to wrap DataQueue into StreamReader. |
@fafhrd91 if it can be done easily, i think it would be good to have it imo :) |
sure, if somebody explain how i can do byte streaming on arbitrary objects, like tuples :) |
From my experience, you can't access to POST variables in a Flask application without a stacktrace with Gunicorn. |
@benoitc how others workers in Gunicorn work to read payload? If they also load all in memory, "readpayload" to True is acceptable. |
@GMLudo sync, thread and the default gevent/eventlet workers are streaming the data. they don't keep the full body in memory. |
readpayload is to True in gaiohttp worker. |
well I still think there should be a way to stream it. Should it be another ticket? |
i've just created #87 |
Thanks! On Sat, Jun 28, 2014 at 8:23 PM, Nikolay Kim notifications@github.com
|
Currently the python spec says that there are several utilities methods that needs to be implemented: http://legacy.python.org/dev/peps/pep-3156/#servers
One is really important the
read(n)
method. Also two other methods are missing.readline()
andreadexcatly(n)
if aiohttp won't cover these method it isn't compatible to 3156 and won't work with a lot of projects.Edit: Here is the class that misses these methods: https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/parsers.py#L281
The text was updated successfully, but these errors were encountered: