> On May 21, 2013, at 6:27 AM, Roberto De Ioris <[email protected]> wrote: > >> Keep-alive on request with body shoulw now work. >> >> Remember: every parsing error (both on request and response) will close >> the connection > > I've been testing this, and it seems to work most of the time (when it > didn't, I think it was a client problem). I just have some questions: > > - Pipeline mode is not supported at all by the http plugin, right? I've > noticed that uWSGI explicitly disables keepalive and closes the connection > after the response when it detects the client has sent more data than the > size of the body.
Pipelining is very particular, expecially because it requires allocating the memory for a new request while the first one is still running. It opens for dos. This is the main problem (obviously we can limit the pipeline size, but currently the http/https/spdy router is faster only because it is simple). But from a technical point of view, pipelining is supported if the second request come after the first request has been passed to the backend, and in my tests, at least chrome and firefox send the request in two different chunk and 99% of the times, pipelining will automatically work :P What Does not work is if the client send a single chunk: """ GET /one HTTP/1.1 Host: foobar.it GET /two HTTP/1.1 Host: foobar.it """ The second part will be swalloed > - Right now I'm manually adding the “Connection: Keep-Alive” header > through the uWSGI config. But sometimes this will not be true, as in the > pipeline case. Can't uWSGI handle this header for me? Only uWSGI knows for > sure if it will maintain the connection open or not. There are cases in > which I respond early to the client with a 4XX error without reading the > whole request from wsgi.input, uWSGI detects this and closes the > connection but the header "Keep-Alive" is sent as well which is also not > true. Btw, Django and other frameworks won't let me add the "Connection" > header since they claim that it the web server responsibility. > The idea of the whole uWSGI project is that your app has the full logic (this is for allowing ISPs to easily account customers) so thanks to the internal routing you will be able to selectively add keep-alive. For example: error-route-status = 200 addheader:Connection: Keep-alive will add the Keep-alive header only for status 200. This is a simple example, you can have more complex rules. By the way, even if you add keep-alive and the server closes the connection it is not a problem for the client (unless it does not respect the standard) -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
