diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-02-08 15:26:19 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-02-08 15:26:19 +0100 |
commit | 08f933a6ad2138ad0fad86496eb3ba88eaf3f173 (patch) | |
tree | 38b27f412660fea6cf01d5ba4cc54e201dbfb2c6 | |
parent | 4627d005d2ead3a3b7f34b25b9e6528d2f9ed99b (diff) |
epoll: immediately notice when other side closes the socket, instead of waiting for timeout (fixes #7192)
-rw-r--r-- | src/microhttpd/connection.c | 2 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index ddf62d77..a154da45 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c @@ -3146,7 +3146,7 @@ parse_cookie_header (struct MHD_Connection *connection) /** * The valid length of any HTTP version string */ -#define HTTP_VER_LEN (MHD_STATICSTR_LEN_(MHD_HTTP_VERSION_1_1)) +#define HTTP_VER_LEN (MHD_STATICSTR_LEN_ (MHD_HTTP_VERSION_1_1)) /** * Detect HTTP version, send error response if version is not supported diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index c98e0b09..97054e59 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c @@ -2848,7 +2848,7 @@ new_connection_process_ (struct MHD_Daemon *daemon, { struct epoll_event event; - event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; + event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET | EPOLLRDHUP; event.data.ptr = connection; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, @@ -5214,7 +5214,7 @@ MHD_epoll (struct MHD_Daemon *daemon, (! daemon->listen_socket_in_epoll) && (! daemon->at_limit) ) { - event.events = EPOLLIN; + event.events = EPOLLIN | EPOLLRDHUP; event.data.ptr = daemon; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, @@ -5247,7 +5247,7 @@ MHD_epoll (struct MHD_Daemon *daemon, if ( ( (! daemon->upgrade_fd_in_epoll) && (-1 != daemon->epoll_upgrade_fd) ) ) { - event.events = EPOLLIN | EPOLLOUT; + event.events = EPOLLIN | EPOLLOUT | EPOLLRDHUP; event.data.ptr = _MHD_DROP_CONST (upgrade_marker); if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, @@ -6956,7 +6956,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && (! daemon->was_quiesced) ) { - event.events = EPOLLIN; + event.events = EPOLLIN | EPOLLRDHUP; event.data.ptr = daemon; if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, @@ -6975,7 +6975,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) if (MHD_ITC_IS_VALID_ (daemon->itc)) { - event.events = EPOLLIN; + event.events = EPOLLIN | EPOLLRDHUP; event.data.ptr = _MHD_DROP_CONST (epoll_itc_marker); if (0 != epoll_ctl (daemon->epoll_fd, EPOLL_CTL_ADD, |