diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 6954e8aa..350c6056 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -821,7 +821,8 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh, | |||
821 | urh->app.celi |= MHD_EPOLL_STATE_READ_READY; | 821 | urh->app.celi |= MHD_EPOLL_STATE_READ_READY; |
822 | if (FD_ISSET (conn_sckt, (fd_set *) _MHD_DROP_CONST (ws))) | 822 | if (FD_ISSET (conn_sckt, (fd_set *) _MHD_DROP_CONST (ws))) |
823 | urh->app.celi |= MHD_EPOLL_STATE_WRITE_READY; | 823 | urh->app.celi |= MHD_EPOLL_STATE_WRITE_READY; |
824 | if (FD_ISSET (conn_sckt, (fd_set *) _MHD_DROP_CONST (es))) | 824 | if ((NULL != es) && |
825 | FD_ISSET (conn_sckt, (fd_set *) _MHD_DROP_CONST (es))) | ||
825 | urh->app.celi |= MHD_EPOLL_STATE_ERROR; | 826 | urh->app.celi |= MHD_EPOLL_STATE_ERROR; |
826 | } | 827 | } |
827 | if ((MHD_INVALID_SOCKET != mhd_sckt)) | 828 | if ((MHD_INVALID_SOCKET != mhd_sckt)) |
@@ -830,7 +831,8 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh, | |||
830 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; | 831 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; |
831 | if (FD_ISSET (mhd_sckt, (fd_set *) _MHD_DROP_CONST (ws))) | 832 | if (FD_ISSET (mhd_sckt, (fd_set *) _MHD_DROP_CONST (ws))) |
832 | urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY; | 833 | urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY; |
833 | if (FD_ISSET (mhd_sckt, (fd_set *) _MHD_DROP_CONST (es))) | 834 | if ((NULL != es) && |
835 | FD_ISSET (mhd_sckt, (fd_set *) _MHD_DROP_CONST (es))) | ||
834 | urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; | 836 | urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; |
835 | } | 837 | } |
836 | } | 838 | } |
@@ -4430,8 +4432,10 @@ internal_run_from_select (struct MHD_Daemon *daemon, | |||
4430 | (fd_set *) _MHD_DROP_CONST (read_fd_set)), | 4432 | (fd_set *) _MHD_DROP_CONST (read_fd_set)), |
4431 | FD_ISSET (ds, | 4433 | FD_ISSET (ds, |
4432 | (fd_set *) _MHD_DROP_CONST (write_fd_set)), | 4434 | (fd_set *) _MHD_DROP_CONST (write_fd_set)), |
4433 | FD_ISSET (ds, | 4435 | (NULL != except_fd_set) ? |
4434 | (fd_set *) _MHD_DROP_CONST (except_fd_set))); | 4436 | (FD_ISSET (ds, |
4437 | (fd_set *) _MHD_DROP_CONST (except_fd_set))) : | ||
4438 | (false)); | ||
4435 | } | 4439 | } |
4436 | } | 4440 | } |
4437 | 4441 | ||
@@ -4497,22 +4501,19 @@ MHD_run_from_select (struct MHD_Daemon *daemon, | |||
4497 | const fd_set *write_fd_set, | 4501 | const fd_set *write_fd_set, |
4498 | const fd_set *except_fd_set) | 4502 | const fd_set *except_fd_set) |
4499 | { | 4503 | { |
4500 | fd_set es; | ||
4501 | if (MHD_D_IS_USING_POLL_ (daemon) || | 4504 | if (MHD_D_IS_USING_POLL_ (daemon) || |
4502 | (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))) | 4505 | (0 != (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))) |
4503 | return MHD_NO; | 4506 | return MHD_NO; |
4504 | if ((NULL == read_fd_set) || (NULL == write_fd_set)) | 4507 | if ((NULL == read_fd_set) || (NULL == write_fd_set)) |
4505 | return MHD_NO; | 4508 | return MHD_NO; |
4506 | if (NULL == except_fd_set) | ||
4507 | { /* Workaround to maintain backward compatibility. */ | ||
4508 | #ifdef HAVE_MESSAGES | 4509 | #ifdef HAVE_MESSAGES |
4510 | if (NULL == except_fd_set) | ||
4511 | { | ||
4509 | MHD_DLOG (daemon, | 4512 | MHD_DLOG (daemon, |
4510 | _ ("MHD_run_from_select() called with except_fd_set " | 4513 | _ ("MHD_run_from_select() called with except_fd_set " |
4511 | "set to NULL. Such behavior is deprecated.\n")); | 4514 | "set to NULL. Such behavior is deprecated.\n")); |
4512 | #endif | ||
4513 | FD_ZERO (&es); | ||
4514 | except_fd_set = &es; | ||
4515 | } | 4515 | } |
4516 | #endif /* HAVE_MESSAGES */ | ||
4516 | if (MHD_D_IS_USING_EPOLL_ (daemon)) | 4517 | if (MHD_D_IS_USING_EPOLL_ (daemon)) |
4517 | { | 4518 | { |
4518 | #ifdef EPOLL_SUPPORT | 4519 | #ifdef EPOLL_SUPPORT |