[dev] synchronous write

Manlio Perillo manlio_perillo at libero.it
Sun Oct 21 13:57:25 MSD 2007


Manlio Perillo ha scritto:
> Hi.
> 
> The mod_wsgi implementation is almost complete.
> The only feature that I have to implement is the write callable:
> http://www.python.org/dev/peps/pep-0333/#the-write-callable
> 
> 
> The problem is that the WSGI spec *requires* the passed-in string to be 
> completely sent to the client when the write function returns.
> 
> Is this possible with Nginx?
> It does not matter that the entire process is blocked.
> 

Igor, do you thing that setting temporarily the socket to blocking mode 
can be a solution?

     out.buf = b;
     out.next = NULL;

     b->pos = data;
     b->last = data + len;

     b->memory = 1;
     b->flush = 1;

     ngx_blocking(self->r->connection->fd);
     rc = ngx_http_output_filter(self->r, &out);
     ngx_nonblocking(self->r->connection->fd);


I have done some tests and it seems to work.



Thanks   Manlio Perillo






More information about the nginx mailing list