diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-12 11:14:49 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-12 11:50:30 +0300 |
commit | 75dbfbc71634af3dae9b5af1bc1e82fec32062e1 (patch) | |
tree | 26ab57f9aa1be6465418d86d124bd489334f11e0 | |
parent | a56499312204a8da5a555f5512b1c898183a8ae2 (diff) | |
download | libmicrohttpd-75dbfbc71634af3dae9b5af1bc1e82fec32062e1.tar.gz libmicrohttpd-75dbfbc71634af3dae9b5af1bc1e82fec32062e1.zip |
Implemented and documented MHD_OPTION_LISTEN_SOCKET followed by MHD_INVALID_SOCKET
-rw-r--r-- | src/include/microhttpd.h | 2 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 9e7e23e2..9d54ddee 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -1780,6 +1780,8 @@ enum MHD_OPTION | |||
1780 | * option is used, MHD will not open its own listen socket(s). The | 1780 | * option is used, MHD will not open its own listen socket(s). The |
1781 | * argument passed must be of type `MHD_socket` and refer to an | 1781 | * argument passed must be of type `MHD_socket` and refer to an |
1782 | * existing socket that has been bound to a port and is listening. | 1782 | * existing socket that has been bound to a port and is listening. |
1783 | * If followed by MHD_INVALID_SOCKET value, MHD ignores this option | ||
1784 | * and creates socket by itself. | ||
1783 | */ | 1785 | */ |
1784 | MHD_OPTION_LISTEN_SOCKET = 12, | 1786 | MHD_OPTION_LISTEN_SOCKET = 12, |
1785 | 1787 | ||
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 283e0839..644e134f 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -7405,11 +7405,12 @@ process_interim_params (struct MHD_Daemon *d, | |||
7405 | 7405 | ||
7406 | if (params->listen_fd_set) | 7406 | if (params->listen_fd_set) |
7407 | { | 7407 | { |
7408 | if (MHD_INVALID_SOCKET == params->listen_fd | 7408 | if (MHD_INVALID_SOCKET == params->listen_fd) |
7409 | { | ||
7410 | (void) 0; /* Use MHD-created socket */ | ||
7411 | } | ||
7409 | #ifdef MHD_POSIX_SOCKETS | 7412 | #ifdef MHD_POSIX_SOCKETS |
7410 | || 0 > params->listen_fd | 7413 | else if (0 > params->listen_fd) |
7411 | #endif /* MHD_POSIX_SOCKETS */ | ||
7412 | ) | ||
7413 | { | 7414 | { |
7414 | #ifdef HAVE_MESSAGES | 7415 | #ifdef HAVE_MESSAGES |
7415 | MHD_DLOG (d, | 7416 | MHD_DLOG (d, |
@@ -7418,6 +7419,7 @@ process_interim_params (struct MHD_Daemon *d, | |||
7418 | #endif /* HAVE_MESSAGES */ | 7419 | #endif /* HAVE_MESSAGES */ |
7419 | return false; | 7420 | return false; |
7420 | } | 7421 | } |
7422 | #endif /* MHD_POSIX_SOCKETS */ | ||
7421 | else if (0 != (d->options & MHD_USE_NO_LISTEN_SOCKET)) | 7423 | else if (0 != (d->options & MHD_USE_NO_LISTEN_SOCKET)) |
7422 | { | 7424 | { |
7423 | #ifdef HAVE_MESSAGES | 7425 | #ifdef HAVE_MESSAGES |