test reading fail when use https

Maxim Dounin mdounin at mdounin.ru
Sun Jun 26 23:53:24 MSD 2011


Hello!

On Sun, Jun 26, 2011 at 09:28:29AM -0400, wandenberg wrote:

[...]

> To solve the problem of detect when users close connection on https I
> did this implementation
> 
> #if (NGX_HTTP_SSL)
>     if (c->ssl == NULL) {
> 	    n = recv(c->fd, buf, 1, MSG_PEEK);
>     } else {
> 	    n = SSL_peek(c->ssl->connection, buf, 1);
>     }
> #else
>     n = recv(c->fd, buf, 1, MSG_PEEK);
> #endif
> 
> I would like to know if you see any other problem on that and if is
> possible to this code be applied on nginx source?

SSL_peek may (and likely will in many cases) leave an error in 
OpenSSL error queue, so I suspect this actually requires a bit 
more code.  

Maxim Dounin



More information about the nginx mailing list