[nginx] Win32: event flags handling edge cases in ngx_wsarecv().
Roman Arutyunyan
arut at nginx.com
Tue Dec 6 15:26:42 UTC 2022
details: https://hg.nginx.org/nginx/rev/56819a9491fe
branches:
changeset: 8111:56819a9491fe
user: Maxim Dounin <mdounin at mdounin.ru>
date: Thu Dec 01 04:22:36 2022 +0300
description:
Win32: event flags handling edge cases in ngx_wsarecv().
Fixed event flags handling edge cases in ngx_wsarecv() and ngx_wsarecv_chain(),
notably to always reset rev->ready in case of errors (which wasn't the case
after ngx_socket_nread() errors), and after EOF (rev->ready was not cleared
if due to a misconfiguration a zero-sized buffer was used for reading).
diffstat:
src/os/win32/ngx_wsarecv.c | 2 ++
src/os/win32/ngx_wsarecv_chain.c | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r 06c7d84cafdb -r 56819a9491fe src/os/win32/ngx_wsarecv.c
--- a/src/os/win32/ngx_wsarecv.c Thu Dec 01 04:22:31 2022 +0300
+++ b/src/os/win32/ngx_wsarecv.c Thu Dec 01 04:22:36 2022 +0300
@@ -78,6 +78,7 @@ ngx_wsarecv(ngx_connection_t *c, u_char
ngx_socket_nread_n " failed");
if (n == NGX_ERROR) {
+ rev->ready = 0;
rev->error = 1;
}
@@ -95,6 +96,7 @@ ngx_wsarecv(ngx_connection_t *c, u_char
}
if (bytes == 0) {
+ rev->ready = 0;
rev->eof = 1;
}
diff -r 06c7d84cafdb -r 56819a9491fe src/os/win32/ngx_wsarecv_chain.c
--- a/src/os/win32/ngx_wsarecv_chain.c Thu Dec 01 04:22:31 2022 +0300
+++ b/src/os/win32/ngx_wsarecv_chain.c Thu Dec 01 04:22:36 2022 +0300
@@ -121,6 +121,7 @@ ngx_wsarecv_chain(ngx_connection_t *c, n
} else if (bytes == size) {
if (ngx_socket_nread(c->fd, &rev->available) == -1) {
+ rev->ready = 0;
rev->error = 1;
ngx_connection_error(c, ngx_socket_errno,
ngx_socket_nread_n " failed");
@@ -138,6 +139,7 @@ ngx_wsarecv_chain(ngx_connection_t *c, n
}
if (bytes == 0) {
+ rev->ready = 0;
rev->eof = 1;
}
More information about the nginx-devel
mailing list