| From | Sent On | Attachments |
|---|---|---|
| wandenberg | Jun 25, 2011 7:48 am | |
| Maxim Dounin | Jun 25, 2011 12:41 pm | |
| wandenberg | Jun 25, 2011 1:05 pm | |
| Maxim Dounin | Jun 25, 2011 1:48 pm | |
| wandenberg | Jun 26, 2011 6:27 am | |
| Maxim Dounin | Jun 26, 2011 12:52 pm | |
| wandenberg | Jul 4, 2011 9:04 am |
| Subject: | Re: test reading fail when use https | |
|---|---|---|
| From: | wandenberg (ngin...@nginx.us) | |
| Date: | Jun 26, 2011 6:27:57 am | |
| List: | ru.sysoev.nginx | |
Hello!
Thanks for your explanation. Now I understood, sorry for my mistakes.
Maxim Dounin Wrote:
-------------------------------------------------------
Hello!
On Sat, Jun 25, 2011 at 04:06:30PM -0400, wandenberg wrote:
Sorry Maxim. I didn't understood your answer.
You can't use c->recv() as it doesn't allow to peek. Using c->recv() will result in possibly valid and required data to be lost. And that's why normal recv() is used instead there.
I turned back to use normal recv() respecting msg_peek functionality.
Can you explain better? Why this work for detect when users goes off on http, but not in https ?
Quoting just 2 days old message from the same list[1]:
% Yes, the code in question won't be able to detect SSL connection % close with appropriate shutdown records sent by a client (as well % as connection close with some other pending data, e.g. pipelined % request). It is not possible to detect connection close with % standard socket interface if there are pending data without % reading that data first, which isn't always desired/possible. % % In the particular case of SSL it should be possible to use % SSL_peek() here, but better aproach is to use OS-provided hint, % e.g. as EV_EOF provided by kqueue interface (and used by nginx).
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?
Maxim Dounin
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx
Thanks for your quickly response.
Regards, Wandenberg
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,209967,210178#msg-210178
_______________________________________________ nginx mailing list ngi...@nginx.org http://nginx.org/mailman/listinfo/nginx





