GithubHelp home page GithubHelp logo

Comments (20)

fafhrd91 avatar fafhrd91 commented on September 26, 2024

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

from aiohttp.

schmitch avatar schmitch commented on September 26, 2024

I thought it is compatible with pep-3156? But it isn't.
It still says:

http client/server for asyncio (PEP-3156)

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

Ah, sorry. I thought about wsgi specs.

Intention for DataQueue is different from StreamReader. You can wrap payload into StreamReader very easily.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

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.

from aiohttp.

schmitch avatar schmitch commented on September 26, 2024

I could, but if I wrap them I would need to write my own program.
But what happens if I use gunicorn with django? It will fail horribly.
So only gunicorn could fix this up, or I would need to write my own 'gunicorn'. Best would be to just include that.

Also PEP-3156 says something about http.

A few functions and classes are provided to simplify the writing of basic stream-based clients and servers, such as FTP or HTTP. Thes are:

It is an Interface and Interfaces should be implemented in my eyes. But who cares.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

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.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

Won't fix

from aiohttp.

benoitc avatar benoitc commented on September 26, 2024

@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.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

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.

from aiohttp.

benoitc avatar benoitc commented on September 26, 2024

@fafhrd91 if it can be done easily, i think it would be good to have it imo :)

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

sure, if somebody explain how i can do byte streaming on arbitrary objects, like tuples :)

from aiohttp.

ludovic-gasc avatar ludovic-gasc commented on September 26, 2024

From my experience, you can't access to POST variables in a Flask application without a stacktrace with Gunicorn.
No idea to resolve that, but it looses the interest if we can't use main WSGI frameworks with that.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

there is a way. we can change "readpayload" to True, then wsgi.input will work as expected. but this will mean that payload gets loaded into memory.

@asvetlov @benoitc thoughts?

from aiohttp.

ludovic-gasc avatar ludovic-gasc commented on September 26, 2024

@benoitc how others workers in Gunicorn work to read payload? If they also load all in memory, "readpayload" to True is acceptable.

from aiohttp.

benoitc avatar benoitc commented on September 26, 2024

@GMLudo sync, thread and the default gevent/eventlet workers are streaming the data. they don't keep the full body in memory.

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

readpayload is to True in gaiohttp worker.

from aiohttp.

benoitc avatar benoitc commented on September 26, 2024

well I still think there should be a way to stream it. Should it be another ticket?

from aiohttp.

fafhrd91 avatar fafhrd91 commented on September 26, 2024

i've just created #87

from aiohttp.

benoitc avatar benoitc commented on September 26, 2024

Thanks!

On Sat, Jun 28, 2014 at 8:23 PM, Nikolay Kim [email protected]
wrote:

i've just created #87 #87


Reply to this email directly or view it on GitHub
#81 (comment).

from aiohttp.

lock avatar lock commented on September 26, 2024

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

from aiohttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.