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) | |
download | libmicrohttpd-08f933a6ad2138ad0fad86496eb3ba88eaf3f173.tar.gz libmicrohttpd-08f933a6ad2138ad0fad86496eb3ba88eaf3f173.zip |
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) | |||
3146 | /** | 3146 | /** |
3147 | * The valid length of any HTTP version string | 3147 | * The valid length of any HTTP version string |
3148 | */ | 3148 | */ |
3149 | #define HTTP_VER_LEN (MHD_STATICSTR_LEN_(MHD_HTTP_VERSION_1_1)) | 3149 | #define HTTP_VER_LEN (MHD_STATICSTR_LEN_ (MHD_HTTP_VERSION_1_1)) |
3150 | 3150 | ||
3151 | /** | 3151 | /** |
3152 | * Detect HTTP version, send error response if version is not supported | 3152 | * 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, | |||
2848 | { | 2848 | { |
2849 | struct epoll_event event; | 2849 | struct epoll_event event; |
2850 | 2850 | ||
2851 | event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET; | 2851 | event.events = EPOLLIN | EPOLLOUT | EPOLLPRI | EPOLLET | EPOLLRDHUP; |
2852 | event.data.ptr = connection; | 2852 | event.data.ptr = connection; |
2853 | if (0 != epoll_ctl (daemon->epoll_fd, | 2853 | if (0 != epoll_ctl (daemon->epoll_fd, |
2854 | EPOLL_CTL_ADD, | 2854 | EPOLL_CTL_ADD, |
@@ -5214,7 +5214,7 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
5214 | (! daemon->listen_socket_in_epoll) && | 5214 | (! daemon->listen_socket_in_epoll) && |
5215 | (! daemon->at_limit) ) | 5215 | (! daemon->at_limit) ) |
5216 | { | 5216 | { |
5217 | event.events = EPOLLIN; | 5217 | event.events = EPOLLIN | EPOLLRDHUP; |
5218 | event.data.ptr = daemon; | 5218 | event.data.ptr = daemon; |
5219 | if (0 != epoll_ctl (daemon->epoll_fd, | 5219 | if (0 != epoll_ctl (daemon->epoll_fd, |
5220 | EPOLL_CTL_ADD, | 5220 | EPOLL_CTL_ADD, |
@@ -5247,7 +5247,7 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
5247 | if ( ( (! daemon->upgrade_fd_in_epoll) && | 5247 | if ( ( (! daemon->upgrade_fd_in_epoll) && |
5248 | (-1 != daemon->epoll_upgrade_fd) ) ) | 5248 | (-1 != daemon->epoll_upgrade_fd) ) ) |
5249 | { | 5249 | { |
5250 | event.events = EPOLLIN | EPOLLOUT; | 5250 | event.events = EPOLLIN | EPOLLOUT | EPOLLRDHUP; |
5251 | event.data.ptr = _MHD_DROP_CONST (upgrade_marker); | 5251 | event.data.ptr = _MHD_DROP_CONST (upgrade_marker); |
5252 | if (0 != epoll_ctl (daemon->epoll_fd, | 5252 | if (0 != epoll_ctl (daemon->epoll_fd, |
5253 | EPOLL_CTL_ADD, | 5253 | EPOLL_CTL_ADD, |
@@ -6956,7 +6956,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) | |||
6956 | if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && | 6956 | if ( (MHD_INVALID_SOCKET != (ls = daemon->listen_fd)) && |
6957 | (! daemon->was_quiesced) ) | 6957 | (! daemon->was_quiesced) ) |
6958 | { | 6958 | { |
6959 | event.events = EPOLLIN; | 6959 | event.events = EPOLLIN | EPOLLRDHUP; |
6960 | event.data.ptr = daemon; | 6960 | event.data.ptr = daemon; |
6961 | if (0 != epoll_ctl (daemon->epoll_fd, | 6961 | if (0 != epoll_ctl (daemon->epoll_fd, |
6962 | EPOLL_CTL_ADD, | 6962 | EPOLL_CTL_ADD, |
@@ -6975,7 +6975,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon) | |||
6975 | 6975 | ||
6976 | if (MHD_ITC_IS_VALID_ (daemon->itc)) | 6976 | if (MHD_ITC_IS_VALID_ (daemon->itc)) |
6977 | { | 6977 | { |
6978 | event.events = EPOLLIN; | 6978 | event.events = EPOLLIN | EPOLLRDHUP; |
6979 | event.data.ptr = _MHD_DROP_CONST (epoll_itc_marker); | 6979 | event.data.ptr = _MHD_DROP_CONST (epoll_itc_marker); |
6980 | if (0 != epoll_ctl (daemon->epoll_fd, | 6980 | if (0 != epoll_ctl (daemon->epoll_fd, |
6981 | EPOLL_CTL_ADD, | 6981 | EPOLL_CTL_ADD, |