test reading fail when use https

Maxim Dounin mdounin at mdounin.ru
Sat Jun 25 23:41:41 MSD 2011


Hello!

On Sat, Jun 25, 2011 at 10:49:32AM -0400, wandenberg wrote:

> Hi,
> 
> I use the function ngx_http_test_reading in the module Nginx Push Stream
> Module (https://github.com/wandenberg/nginx-push-stream-module) to know
> when the user goes off, but when using https  this function always
> return a value on call 
> n = recv(c->fd, buf, 1, MSG_PEEK);
> 
> Checking what was happening and comparing with others calls on same file
> ngx_http_request.c I saw that others calls are done with c->recv instead
> of recv .
> 
> On the case of https this c->recv points to ngx_ssl_recv, which can sure
> detect when user goes off.
> 
> I would like to suggest to change the line 
> n = recv(c->fd, buf, 1, MSG_PEEK); 
> for 
> n = c->recv(c, buf, 1);
> 
> and 
> } else if (n == -1) {
> for
> } else if ((n == -1) || (n == -2)) {
> 
> to other returns on https.
> 
> I'm not sure if it has any side effect, and don't know if here is the
> best place to do this suggestion, sorry if not.

There is a MSG_PEEK for reason.

Maxim Dounin



More information about the nginx mailing list