Meanwhile I think I have discovered a bug. When doing the request manually, 
pasting the request to a telnet session, the keepalive works. But if I issue 
the request using cURL, the connection is closed by the server after the 
response is sent.

In the code this section in http.c is entered:
                        if (hr->remains > 0) {
                                hr->session.can_keepalive = 0;

hr->remains is equal to the length of the request. It seems uWSGI thinks I have 
not read the request but my application has read it and produced a response. 
When I paste the request manually, hr->remains is <= 0.

An example request:

POST /api/sync/commit_batch HTTP/1.1
Host: xxx
Accept: */*
Authorization: xxx
Content-Length: 316
Content-Type: application/x-www-form-urlencoded

commit_info=eJw9jlFvgjAYRf_K8j3TSKV2yNuGDyAyE8PmkrmQWqpUaGEtxmbG_y4my95ucu_NOV9X2LcdbyxEAB5IW1bSQOR7oAapBEQIe2Dl71_qmRF6KP8v5XuGu_iniXsds5BuU_daT806yfRe6UXxll5SihOaG3fKXz7Wn1V6cts6Wcp2EWTh2WWbhi_z7tCoc1HI-HLcFKvVcRTRTAnbMy5kNWJowElFCUHPM0ERmWGORhpBIcZ0HoRszjmBh91Qj-uJVaxtD7IVdoJ93x8bNgzm4XvdQd9Z6XYQPZGpf4Pb9x1WylBC


On May 21, 2013, at 4:14 PM, Roberto De Ioris <[email protected]> wrote:

> chunk and 99% of the times, pipelining will automatically work :P

Great. :)

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

Thanks, I will study these routing rules. It will be the first time using 
them...

> 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)

What I've seen happen is that when a browser is doing a multiple-file upload, 
it will try to reuse the connection and start sending the next file before it 
notices that the connection is being closed. This will cause that upload to 
fail.

André
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to