aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/microhttpd/daemon.c4
-rw-r--r--src/microhttpd/internal.h9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 916544fa..8f548945 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -5403,6 +5403,9 @@ parse_options_va (struct MHD_Daemon *daemon,
5403 5403
5404 while (MHD_OPTION_END != (opt = (enum MHD_OPTION) va_arg (ap, int))) 5404 while (MHD_OPTION_END != (opt = (enum MHD_OPTION) va_arg (ap, int)))
5405 { 5405 {
5406 /* Increase counter at start, so resulting value is number of
5407 * processed options, including any failed ones. */
5408 daemon->num_opts++;
5406 switch (opt) 5409 switch (opt)
5407 { 5410 {
5408 case MHD_OPTION_CONNECTION_MEMORY_LIMIT: 5411 case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
@@ -5784,6 +5787,7 @@ parse_options_va (struct MHD_Daemon *daemon,
5784#endif /* HAVE_MESSAGES */ 5787#endif /* HAVE_MESSAGES */
5785 break; 5788 break;
5786 case MHD_OPTION_ARRAY: 5789 case MHD_OPTION_ARRAY:
5790 daemon->num_opts--; /* Do not count MHD_OPTION_ARRAY */
5787 oa = va_arg (ap, struct MHD_OptionItem*); 5791 oa = va_arg (ap, struct MHD_OptionItem*);
5788 i = 0; 5792 i = 0;
5789 while (MHD_OPTION_END != (opt = oa[i].option)) 5793 while (MHD_OPTION_END != (opt = oa[i].option))
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 06e7e4a7..dc38bada 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1920,6 +1920,15 @@ struct MHD_Daemon
1920 * The size of queue for listen socket. 1920 * The size of queue for listen socket.
1921 */ 1921 */
1922 unsigned int listen_backlog_size; 1922 unsigned int listen_backlog_size;
1923
1924 /**
1925 * The number of user options used.
1926 *
1927 * Contains number of only meaningful options, i.e. #MHD_OPTION_END
1928 * and #MHD_OPTION_ARRAY are not counted, while options inside
1929 * #MHD_OPTION_ARRAY are counted.
1930 */
1931 size_t num_opts;
1923}; 1932};
1924 1933
1925 1934