aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/microhttpd2.h128
-rw-r--r--src/lib/connection_close.c13
-rw-r--r--src/lib/connection_close.h7
-rw-r--r--src/lib/daemon_poll.c16
-rw-r--r--src/lib/daemon_start.c10
5 files changed, 88 insertions, 86 deletions
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index a3494aeb..34a9a80a 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -276,7 +276,7 @@ typedef SOCKET MHD_socket;
276 */ 276 */
277#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__)) 277#define MHD_NONNULL(...) __THROW __nonnull((__VA_ARGS__))
278 278
279 279
280/** 280/**
281 * Not all architectures and `printf()`'s support the `long long` type. 281 * Not all architectures and `printf()`'s support the `long long` type.
282 * This gives the ability to replace `long long` with just a `long`, 282 * This gives the ability to replace `long long` with just a `long`,
@@ -336,7 +336,7 @@ enum MHD_StatusCode
336 336
337 /* 00000-level status codes indicate return values 337 /* 00000-level status codes indicate return values
338 the application must act on. */ 338 the application must act on. */
339 339
340 /** 340 /**
341 * Successful operation (not used for logging). 341 * Successful operation (not used for logging).
342 */ 342 */
@@ -347,10 +347,10 @@ enum MHD_StatusCode
347 */ 347 */
348 MHD_SC_NO_TIMEOUT = 1, 348 MHD_SC_NO_TIMEOUT = 1,
349 349
350 350
351 /* 10000-level status codes indicate intermediate 351 /* 10000-level status codes indicate intermediate
352 results of some kind. */ 352 results of some kind. */
353 353
354 /** 354 /**
355 * Informational event, MHD started. 355 * Informational event, MHD started.
356 */ 356 */
@@ -391,11 +391,11 @@ enum MHD_StatusCode
391 */ 391 */
392 MHD_SC_APPLICATION_DATA_GENERATION_FINISHED = 20001, 392 MHD_SC_APPLICATION_DATA_GENERATION_FINISHED = 20001,
393 393
394 394
395 /* 30000-level status codes indicate transient failures 395 /* 30000-level status codes indicate transient failures
396 that might go away if the client tries again. */ 396 that might go away if the client tries again. */
397 397
398 398
399 /** 399 /**
400 * Resource limit in terms of number of parallel connections 400 * Resource limit in terms of number of parallel connections
401 * hit. 401 * hit.
@@ -410,7 +410,7 @@ enum MHD_StatusCode
410 410
411 /** 411 /**
412 * The operation failed because the respective 412 * The operation failed because the respective
413 * daemon is already too deep inside of the shutdown 413 * daemon is already too deep inside of the shutdown
414 * activity. 414 * activity.
415 */ 415 */
416 MHD_SC_DAEMON_ALREADY_SHUTDOWN = 30002, 416 MHD_SC_DAEMON_ALREADY_SHUTDOWN = 30002,
@@ -453,7 +453,7 @@ enum MHD_StatusCode
453 * (May be transient.) 453 * (May be transient.)
454 */ 454 */
455 MHD_SC_POOL_MALLOC_FAILURE = 30009, 455 MHD_SC_POOL_MALLOC_FAILURE = 30009,
456 456
457 /** 457 /**
458 * We failed to forward data from a Web socket to the 458 * We failed to forward data from a Web socket to the
459 * application to the remote side due to the socket 459 * application to the remote side due to the socket
@@ -468,8 +468,8 @@ enum MHD_StatusCode
468 */ 468 */
469 MHD_SC_CONNECTION_POOL_MALLOC_FAILURE = 30011, 469 MHD_SC_CONNECTION_POOL_MALLOC_FAILURE = 30011,
470 470
471 471
472 /* 40000-level errors are caused by the HTTP client 472 /* 40000-level errors are caused by the HTTP client
473 (or the network) */ 473 (or the network) */
474 474
475 /** 475 /**
@@ -515,7 +515,7 @@ enum MHD_StatusCode
515 */ 515 */
516 MHD_SC_CHUNKED_ENCODING_MALFORMED = 40007, 516 MHD_SC_CHUNKED_ENCODING_MALFORMED = 40007,
517 517
518 518
519 519
520 /* 50000-level errors are because of an error internal 520 /* 50000-level errors are because of an error internal
521 to the MHD logic, possibly including our interaction 521 to the MHD logic, possibly including our interaction
@@ -526,7 +526,7 @@ enum MHD_StatusCode
526 * requested TLS. 526 * requested TLS.
527 */ 527 */
528 MHD_SC_TLS_DISABLED = 50000, 528 MHD_SC_TLS_DISABLED = 50000,
529 529
530 /** 530 /**
531 * The application attempted to setup TLS paramters before 531 * The application attempted to setup TLS paramters before
532 * enabling TLS. 532 * enabling TLS.
@@ -575,7 +575,7 @@ enum MHD_StatusCode
575 * We failed to open the listen socket. Maybe the build 575 * We failed to open the listen socket. Maybe the build
576 * supports IPv6, but your kernel does not? 576 * supports IPv6, but your kernel does not?
577 */ 577 */
578 MHD_SC_FAILED_TO_OPEN_LISTEN_SOCKET = 50011, 578 MHD_SC_FAILED_TO_OPEN_LISTEN_SOCKET = 50011,
579 579
580 /** 580 /**
581 * Specified address family is not supported by this build. 581 * Specified address family is not supported by this build.
@@ -591,7 +591,7 @@ enum MHD_StatusCode
591 * Enabling listen address reuse is not supported by this platform. 591 * Enabling listen address reuse is not supported by this platform.
592 */ 592 */
593 MHD_SC_LISTEN_ADDRESS_REUSE_ENABLE_NOT_SUPPORTED = 50014, 593 MHD_SC_LISTEN_ADDRESS_REUSE_ENABLE_NOT_SUPPORTED = 50014,
594 594
595 /** 595 /**
596 * Failed to disable listen address reuse. 596 * Failed to disable listen address reuse.
597 */ 597 */
@@ -603,7 +603,7 @@ enum MHD_StatusCode
603 MHD_SC_LISTEN_ADDRESS_REUSE_DISABLE_NOT_SUPPORTED = 50016, 603 MHD_SC_LISTEN_ADDRESS_REUSE_DISABLE_NOT_SUPPORTED = 50016,
604 604
605 /** 605 /**
606 * We failed to explicitly enable or disable dual stack for 606 * We failed to explicitly enable or disable dual stack for
607 * the IPv6 listen socket. The socket will be used in whatever 607 * the IPv6 listen socket. The socket will be used in whatever
608 * the default is the OS gives us. 608 * the default is the OS gives us.
609 */ 609 */
@@ -666,7 +666,7 @@ enum MHD_StatusCode
666 * Failed to signal via ITC channel. 666 * Failed to signal via ITC channel.
667 */ 667 */
668 MHD_SC_ITC_USE_FAILED = 50029, 668 MHD_SC_ITC_USE_FAILED = 50029,
669 669
670 /** 670 /**
671 * We failed to initialize the main thread for listening. 671 * We failed to initialize the main thread for listening.
672 */ 672 */
@@ -681,7 +681,7 @@ enum MHD_StatusCode
681 * We failed to add a socket to the epoll() set. 681 * We failed to add a socket to the epoll() set.
682 */ 682 */
683 MHD_SC_EPOLL_CTL_ADD_FAILED = 50032, 683 MHD_SC_EPOLL_CTL_ADD_FAILED = 50032,
684 684
685 /** 685 /**
686 * We failed to create control socket for the epoll(). 686 * We failed to create control socket for the epoll().
687 */ 687 */
@@ -724,7 +724,7 @@ enum MHD_StatusCode
724 MHD_SC_CONFIGURATION_MISSMATCH_FOR_RUN_EXTERNAL = 50040, 724 MHD_SC_CONFIGURATION_MISSMATCH_FOR_RUN_EXTERNAL = 50040,
725 725
726 /** 726 /**
727 * Encountered an unexpected event loop style 727 * Encountered an unexpected event loop style
728 * (should never happen). 728 * (should never happen).
729 */ 729 */
730 MHD_SC_CONFIGURATION_UNEXPECTED_ELS = 50041, 730 MHD_SC_CONFIGURATION_UNEXPECTED_ELS = 50041,
@@ -739,19 +739,19 @@ enum MHD_StatusCode
739 * poll() is not supported. 739 * poll() is not supported.
740 */ 740 */
741 MHD_SC_POLL_NOT_SUPPORTED = 50043, 741 MHD_SC_POLL_NOT_SUPPORTED = 50043,
742 742
743 /** 743 /**
744 * Encountered an unexpected error from poll() 744 * Encountered an unexpected error from poll()
745 * (should never happen). 745 * (should never happen).
746 */ 746 */
747 MHD_SC_UNEXPECTED_POLL_ERROR = 50044, 747 MHD_SC_UNEXPECTED_POLL_ERROR = 50044,
748 748
749 /** 749 /**
750 * We failed to configure accepted socket 750 * We failed to configure accepted socket
751 * to not use a signal pipe. 751 * to not use a signal pipe.
752 */ 752 */
753 MHD_SC_ACCEPT_CONFIGURE_NOSIGPIPE_FAILED = 50045, 753 MHD_SC_ACCEPT_CONFIGURE_NOSIGPIPE_FAILED = 50045,
754 754
755 /** 755 /**
756 * Encountered an unexpected error from epoll_wait() 756 * Encountered an unexpected error from epoll_wait()
757 * (should never happen). 757 * (should never happen).
@@ -809,7 +809,7 @@ enum MHD_StatusCode
809 * to parse the cookie header. 809 * to parse the cookie header.
810 */ 810 */
811 MHD_SC_COOKIE_POOL_ALLOCATION_FAILURE = 50055, 811 MHD_SC_COOKIE_POOL_ALLOCATION_FAILURE = 50055,
812 812
813 /** 813 /**
814 * MHD failed to build the response header. 814 * MHD failed to build the response header.
815 */ 815 */
@@ -931,19 +931,19 @@ enum MHD_Method
931 931
932 /** 932 /**
933 * "POST" method. 933 * "POST" method.
934 * Not safe. Not idempotent. RFC7231, Section 4.3.3. 934 * Not safe. Not idempotent. RFC7231, Section 4.3.3.
935 */ 935 */
936 MHD_METHOD_POST = 4, 936 MHD_METHOD_POST = 4,
937 937
938 /** 938 /**
939 * "PUT" method. 939 * "PUT" method.
940 * Not safe. Idempotent. RFC7231, Section 4.3.4. 940 * Not safe. Idempotent. RFC7231, Section 4.3.4.
941 */ 941 */
942 MHD_METHOD_PUT = 5, 942 MHD_METHOD_PUT = 5,
943 943
944 /** 944 /**
945 * "DELETE" method. 945 * "DELETE" method.
946 * Not safe. Idempotent. RFC7231, Section 4.3.5. 946 * Not safe. Idempotent. RFC7231, Section 4.3.5.
947 */ 947 */
948 MHD_METHOD_DELETE = 6, 948 MHD_METHOD_DELETE = 6,
949 949
@@ -956,158 +956,158 @@ enum MHD_Method
956 * "CONNECT" method. 956 * "CONNECT" method.
957 */ 957 */
958 MHD_METHOD_CONNECT = 8, 958 MHD_METHOD_CONNECT = 8,
959 959
960 /** 960 /**
961 * "ACL" method. 961 * "ACL" method.
962 */ 962 */
963 MHD_METHOD_ACL = 9, 963 MHD_METHOD_ACL = 9,
964 964
965 /** 965 /**
966 * "BASELINE-CONTROL" method. 966 * "BASELINE-CONTROL" method.
967 */ 967 */
968 MHD_METHOD_BASELINE_CONTROL = 10, 968 MHD_METHOD_BASELINE_CONTROL = 10,
969 969
970 /** 970 /**
971 * "BIND" method. 971 * "BIND" method.
972 */ 972 */
973 MHD_METHOD_BIND = 11, 973 MHD_METHOD_BIND = 11,
974 974
975 /** 975 /**
976 * "CHECKIN" method. 976 * "CHECKIN" method.
977 */ 977 */
978 MHD_METHOD_CHECKIN = 12, 978 MHD_METHOD_CHECKIN = 12,
979 979
980 /** 980 /**
981 * "CHECKOUT" method. 981 * "CHECKOUT" method.
982 */ 982 */
983 MHD_METHOD_CHECKOUT = 13, 983 MHD_METHOD_CHECKOUT = 13,
984 984
985 /** 985 /**
986 * "COPY" method. 986 * "COPY" method.
987 */ 987 */
988 MHD_METHOD_COPY = 14, 988 MHD_METHOD_COPY = 14,
989 989
990 /** 990 /**
991 * "LABEL" method. 991 * "LABEL" method.
992 */ 992 */
993 MHD_METHOD_LABEL = 15, 993 MHD_METHOD_LABEL = 15,
994 994
995 /** 995 /**
996 * "LINK" method. 996 * "LINK" method.
997 */ 997 */
998 MHD_METHOD_LINK = 16, 998 MHD_METHOD_LINK = 16,
999 999
1000 /** 1000 /**
1001 * "LOCK" method. 1001 * "LOCK" method.
1002 */ 1002 */
1003 MHD_METHOD_LOCK = 17, 1003 MHD_METHOD_LOCK = 17,
1004 1004
1005 /** 1005 /**
1006 * "MERGE" method. 1006 * "MERGE" method.
1007 */ 1007 */
1008 MHD_METHOD_MERGE = 18, 1008 MHD_METHOD_MERGE = 18,
1009 1009
1010 /** 1010 /**
1011 * "MKACTIVITY" method. 1011 * "MKACTIVITY" method.
1012 */ 1012 */
1013 MHD_METHOD_MKACTIVITY = 19, 1013 MHD_METHOD_MKACTIVITY = 19,
1014 1014
1015 /** 1015 /**
1016 * "MKCOL" method. 1016 * "MKCOL" method.
1017 */ 1017 */
1018 MHD_METHOD_MKCOL = 20, 1018 MHD_METHOD_MKCOL = 20,
1019 1019
1020 /** 1020 /**
1021 * "MKREDIRECTREF" method. 1021 * "MKREDIRECTREF" method.
1022 */ 1022 */
1023 MHD_METHOD_MKREDIRECTREF = 21, 1023 MHD_METHOD_MKREDIRECTREF = 21,
1024 1024
1025 /** 1025 /**
1026 * "MKWORKSPACE" method. 1026 * "MKWORKSPACE" method.
1027 */ 1027 */
1028 MHD_METHOD_MKWORKSPACE = 22, 1028 MHD_METHOD_MKWORKSPACE = 22,
1029 1029
1030 /** 1030 /**
1031 * "MOVE" method. 1031 * "MOVE" method.
1032 */ 1032 */
1033 MHD_METHOD_MOVE = 23, 1033 MHD_METHOD_MOVE = 23,
1034 1034
1035 /** 1035 /**
1036 * "ORDERPATCH" method. 1036 * "ORDERPATCH" method.
1037 */ 1037 */
1038 MHD_METHOD_ORDERPATCH = 24, 1038 MHD_METHOD_ORDERPATCH = 24,
1039 1039
1040 /** 1040 /**
1041 * "PATCH" method. 1041 * "PATCH" method.
1042 */ 1042 */
1043 MHD_METHOD_PATH = 25, 1043 MHD_METHOD_PATH = 25,
1044 1044
1045 /** 1045 /**
1046 * "PRI" method. 1046 * "PRI" method.
1047 */ 1047 */
1048 MHD_METHOD_PRI = 26, 1048 MHD_METHOD_PRI = 26,
1049 1049
1050 /** 1050 /**
1051 * "PROPFIND" method. 1051 * "PROPFIND" method.
1052 */ 1052 */
1053 MHD_METHOD_PROPFIND = 27, 1053 MHD_METHOD_PROPFIND = 27,
1054 1054
1055 /** 1055 /**
1056 * "PROPPATCH" method. 1056 * "PROPPATCH" method.
1057 */ 1057 */
1058 MHD_METHOD_PROPPATCH = 28, 1058 MHD_METHOD_PROPPATCH = 28,
1059 1059
1060 /** 1060 /**
1061 * "REBIND" method. 1061 * "REBIND" method.
1062 */ 1062 */
1063 MHD_METHOD_REBIND = 29, 1063 MHD_METHOD_REBIND = 29,
1064 1064
1065 /** 1065 /**
1066 * "REPORT" method. 1066 * "REPORT" method.
1067 */ 1067 */
1068 MHD_METHOD_REPORT = 30, 1068 MHD_METHOD_REPORT = 30,
1069 1069
1070 /** 1070 /**
1071 * "SEARCH" method. 1071 * "SEARCH" method.
1072 */ 1072 */
1073 MHD_METHOD_SEARCH = 31, 1073 MHD_METHOD_SEARCH = 31,
1074 1074
1075 /** 1075 /**
1076 * "UNBIND" method. 1076 * "UNBIND" method.
1077 */ 1077 */
1078 MHD_METHOD_UNBIND = 32, 1078 MHD_METHOD_UNBIND = 32,
1079 1079
1080 /** 1080 /**
1081 * "UNCHECKOUT" method. 1081 * "UNCHECKOUT" method.
1082 */ 1082 */
1083 MHD_METHOD_UNCHECKOUT = 33, 1083 MHD_METHOD_UNCHECKOUT = 33,
1084 1084
1085 /** 1085 /**
1086 * "UNLINK" method. 1086 * "UNLINK" method.
1087 */ 1087 */
1088 MHD_METHOD_UNLINK = 34, 1088 MHD_METHOD_UNLINK = 34,
1089 1089
1090 /** 1090 /**
1091 * "UNLOCK" method. 1091 * "UNLOCK" method.
1092 */ 1092 */
1093 MHD_METHOD_UNLOCK = 35, 1093 MHD_METHOD_UNLOCK = 35,
1094 1094
1095 /** 1095 /**
1096 * "UPDATE" method. 1096 * "UPDATE" method.
1097 */ 1097 */
1098 MHD_METHOD_UPDATE = 36, 1098 MHD_METHOD_UPDATE = 36,
1099 1099
1100 /** 1100 /**
1101 * "UPDATEDIRECTREF" method. 1101 * "UPDATEDIRECTREF" method.
1102 */ 1102 */
1103 MHD_METHOD_UPDATEDIRECTREF = 37, 1103 MHD_METHOD_UPDATEDIRECTREF = 37,
1104 1104
1105 /** 1105 /**
1106 * "VERSION-CONTROL" method. 1106 * "VERSION-CONTROL" method.
1107 */ 1107 */
1108 MHD_METHOD_VERSION_CONTROL = 38 1108 MHD_METHOD_VERSION_CONTROL = 38
1109 1109
1110 /* For more, check: 1110 /* For more, check:
1111 https://www.iana.org/assignments/http-methods/http-methods.xhtml */ 1111 https://www.iana.org/assignments/http-methods/http-methods.xhtml */
1112 1112
1113}; 1113};
@@ -1917,12 +1917,12 @@ enum MHD_AddressFamily
1917 * other means). 1917 * other means).
1918 */ 1918 */
1919 MHD_AF_NONE = 0, 1919 MHD_AF_NONE = 0,
1920 1920
1921 /** 1921 /**
1922 * Pick "best" available method automatically. 1922 * Pick "best" available method automatically.
1923 */ 1923 */
1924 MHD_AF_AUTO, 1924 MHD_AF_AUTO,
1925 1925
1926 /** 1926 /**
1927 * Use IPv4. 1927 * Use IPv4.
1928 */ 1928 */
@@ -2335,7 +2335,7 @@ typedef void *
2335 2335
2336/** 2336/**
2337 * Register a callback to be called first for every request 2337 * Register a callback to be called first for every request
2338 * (before any parsing of the header). Makes it easy to 2338 * (before any parsing of the header). Makes it easy to
2339 * log the full URL. 2339 * log the full URL.
2340 * 2340 *
2341 * @param daemon daemon for which to set the logger 2341 * @param daemon daemon for which to set the logger
@@ -2550,7 +2550,7 @@ MHD_daemon_digest_auth_nc_length (struct MHD_Daemon *daemon,
2550 2550
2551/** 2551/**
2552 * Set custom timeout for the given connection. 2552 * Set custom timeout for the given connection.
2553 * Specified as the number of seconds. Use zero for no timeout. 2553 * Specified as the number of seconds. Use zero for no timeout.
2554 * Calling this function will reset timeout timer. 2554 * Calling this function will reset timeout timer.
2555 * 2555 *
2556 * @param connection connection to configure timeout for 2556 * @param connection connection to configure timeout for
@@ -2972,7 +2972,7 @@ enum MHD_RequestTerminationCode
2972}; 2972};
2973 2973
2974 2974
2975/** 2975/**
2976 * Signature of the callback used by MHD to notify the application 2976 * Signature of the callback used by MHD to notify the application
2977 * about completed requests. 2977 * about completed requests.
2978 * 2978 *
@@ -3601,7 +3601,7 @@ enum MHD_ConnectionInformationType
3601 * @ingroup request 3601 * @ingroup request
3602 */ 3602 */
3603 MHD_CONNECTION_INFORMATION_CONNECTION_TIMEOUT, 3603 MHD_CONNECTION_INFORMATION_CONNECTION_TIMEOUT,
3604 3604
3605 /** 3605 /**
3606 * Check whether the connection is suspended. 3606 * Check whether the connection is suspended.
3607 * @ingroup request 3607 * @ingroup request
@@ -3667,7 +3667,7 @@ union MHD_ConnectionInformation
3667 * #MHD_NotifyConnectionCallback. 3667 * #MHD_NotifyConnectionCallback.
3668 */ 3668 */
3669 void **socket_context; 3669 void **socket_context;
3670 3670
3671 /** 3671 /**
3672 * Is this connection right now suspended? 3672 * Is this connection right now suspended?
3673 */ 3673 */
@@ -3767,7 +3767,7 @@ enum MHD_RequestInformationType
3767 * is specific to this request. 3767 * is specific to this request.
3768 */ 3768 */
3769 MHD_REQUEST_INFORMATION_CLIENT_CONTEXT, 3769 MHD_REQUEST_INFORMATION_CLIENT_CONTEXT,
3770 3770
3771 /** 3771 /**
3772 * Return the HTTP version string given by the client. 3772 * Return the HTTP version string given by the client.
3773 * @ingroup request 3773 * @ingroup request
diff --git a/src/lib/connection_close.c b/src/lib/connection_close.c
index ad15ce7a..945997db 100644
--- a/src/lib/connection_close.c
+++ b/src/lib/connection_close.c
@@ -39,11 +39,11 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
39 39
40 connection->request.state = MHD_REQUEST_CLOSED; 40 connection->request.state = MHD_REQUEST_CLOSED;
41 connection->request.event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP; 41 connection->request.event_loop_info = MHD_EVENT_LOOP_INFO_CLEANUP;
42 if (! daemon->enable_turbo) 42 if (! daemon->enable_turbo)
43 { 43 {
44#ifdef HTTPS_SUPPORT 44#ifdef HTTPS_SUPPORT
45 struct MHD_TLS_Plugin *tls; 45 struct MHD_TLS_Plugin *tls;
46 46
47 /* For TLS connection use shutdown of TLS layer 47 /* For TLS connection use shutdown of TLS layer
48 * and do not shutdown TCP socket. This give more 48 * and do not shutdown TCP socket. This give more
49 * chances to send TLS closure data to remote side. 49 * chances to send TLS closure data to remote side.
@@ -78,25 +78,26 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
78 * connection's recv(), send() and response. 78 * connection's recv(), send() and response.
79 * 79 *
80 * @param connection connection to close 80 * @param connection connection to close
81 * @param cnc termination reason to give 81 * @param rtc termination reason to give
82 */ 82 */
83void 83void
84MHD_connection_close_ (struct MHD_Connection *connection, 84MHD_connection_close_ (struct MHD_Connection *connection,
85 enum MHD_ConnectionNotificationCode cnc) 85 enum MHD_RequestTerminationCode rtc)
86{ 86{
87 struct MHD_Daemon *daemon = connection->daemon; 87 struct MHD_Daemon *daemon = connection->daemon;
88 struct MHD_Response *resp = connection->request.response; 88 struct MHD_Response *resp = connection->request.response;
89 89
90 (void) rtc; // FIXME
90 MHD_connection_mark_closed_ (connection); 91 MHD_connection_mark_closed_ (connection);
91 if (NULL != resp) 92 if (NULL != resp)
92 { 93 {
93 connection->request.response = NULL; 94 connection->request.response = NULL;
94 MHD_response_queue_for_destroy (resp); 95 MHD_response_queue_for_destroy (resp);
95 } 96 }
96 if (NULL != daemon->notify_connection_cb) 97 if (NULL != daemon->notify_connection_cb)
97 daemon->notify_connection_cb (daemon->notify_connection_cb_cls, 98 daemon->notify_connection_cb (daemon->notify_connection_cb_cls,
98 connection, 99 connection,
99 cnc); 100 MHD_CONNECTION_NOTIFY_CLOSED);
100} 101}
101 102
102/* end of connection_close.c */ 103/* end of connection_close.c */
diff --git a/src/lib/connection_close.h b/src/lib/connection_close.h
index db1778bb..41f141d2 100644
--- a/src/lib/connection_close.h
+++ b/src/lib/connection_close.h
@@ -21,10 +21,11 @@
21 * @brief functions to close connection 21 * @brief functions to close connection
22 * @author Christian Grothoff 22 * @author Christian Grothoff
23 */ 23 */
24
25#ifndef CONNECTION_CLOSE_H 24#ifndef CONNECTION_CLOSE_H
26#define CONNECTION_CLOSE_H 25#define CONNECTION_CLOSE_H
27 26
27#include "microhttpd2.h"
28
28/** 29/**
29 * Mark connection as "closed". 30 * Mark connection as "closed".
30 * 31 *
@@ -45,11 +46,11 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
45 * connection's recv(), send() and response. 46 * connection's recv(), send() and response.
46 * 47 *
47 * @param connection connection to close 48 * @param connection connection to close
48 * @param cnc termination reason to give 49 * @param rtc termination reason to give
49 */ 50 */
50void 51void
51MHD_connection_close_ (struct MHD_Connection *connection, 52MHD_connection_close_ (struct MHD_Connection *connection,
52 enum MHD_ConnectionNotificationCode cnc) 53 enum MHD_RequestTerminationCode rtc)
53 MHD_NONNULL (1); 54 MHD_NONNULL (1);
54 55
55#endif 56#endif
diff --git a/src/lib/daemon_poll.c b/src/lib/daemon_poll.c
index 28256f1f..1afd93be 100644
--- a/src/lib/daemon_poll.c
+++ b/src/lib/daemon_poll.c
@@ -76,7 +76,7 @@ urh_update_pollfd (struct MHD_UpgradeResponseHandle *urh,
76 (0 != urh->in_buffer_used))) 76 (0 != urh->in_buffer_used)))
77 p[1].events |= MHD_POLL_EVENTS_ERR_DISC; 77 p[1].events |= MHD_POLL_EVENTS_ERR_DISC;
78} 78}
79 79
80 80
81/** 81/**
82 * Set @a p to watch for @a urh. 82 * Set @a p to watch for @a urh.
@@ -283,7 +283,7 @@ MHD_daemon_poll_all_ (struct MHD_Daemon *daemon,
283 if (daemon->shutdown) 283 if (daemon->shutdown)
284 { 284 {
285 free(p); 285 free(p);
286 return MHD_NO; 286 return MHD_SC_DAEMON_ALREADY_SHUTDOWN;
287 } 287 }
288 i = 0; 288 i = 0;
289 prev = daemon->connections_tail; 289 prev = daemon->connections_tail;
@@ -343,7 +343,7 @@ MHD_daemon_poll_all_ (struct MHD_Daemon *daemon,
343 343
344 free(p); 344 free(p);
345 } 345 }
346 return MHD_YES; 346 return MHD_SC_OK;
347} 347}
348 348
349 349
@@ -482,22 +482,22 @@ MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con)
482 (0 != urh->out_buffer_used) ) 482 (0 != urh->out_buffer_used) )
483 { 483 {
484 int timeout; 484 int timeout;
485 485
486 urh_update_pollfd (urh, 486 urh_update_pollfd (urh,
487 p); 487 p);
488 488
489 if ( (con->tls_read_ready) && 489 if ( (con->tls_read_ready) &&
490 (urh->in_buffer_used < urh->in_buffer_size)) 490 (urh->in_buffer_used < urh->in_buffer_size))
491 timeout = 0; /* No need to wait if incoming data is already pending in TLS buffers. */ 491 timeout = 0; /* No need to wait if incoming data is already pending in TLS buffers. */
492 else 492 else
493 timeout = -1; 493 timeout = -1;
494 494
495 if (MHD_sys_poll_ (p, 495 if (MHD_sys_poll_ (p,
496 2, 496 2,
497 timeout) < 0) 497 timeout) < 0)
498 { 498 {
499 const int err = MHD_socket_get_error_ (); 499 const int err = MHD_socket_get_error_ ();
500 500
501 if (MHD_SCKT_ERR_IS_EINTR_ (err)) 501 if (MHD_SCKT_ERR_IS_EINTR_ (err))
502 continue; 502 continue;
503#ifdef HAVE_MESSAGES 503#ifdef HAVE_MESSAGES
@@ -514,5 +514,5 @@ MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con)
514 } 514 }
515} 515}
516#endif 516#endif
517 517
518/* end of daemon_poll.c */ 518/* end of daemon_poll.c */
diff --git a/src/lib/daemon_start.c b/src/lib/daemon_start.c
index 4705851d..8e4a2c64 100644
--- a/src/lib/daemon_start.c
+++ b/src/lib/daemon_start.c
@@ -551,18 +551,18 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
551 /* FIXME: update function! */ 551 /* FIXME: update function! */
552 daemon->epoll_fd = setup_epoll_fd (daemon); 552 daemon->epoll_fd = setup_epoll_fd (daemon);
553 if (-1 == daemon->epoll_fd) 553 if (-1 == daemon->epoll_fd)
554 return MHD_NO; 554 return MHD_SC_EPOLL_CTL_CREATE_FAILED;
555#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT) 555#if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
556 if (! daemon->disallow_upgrade) 556 if (! daemon->disallow_upgrade)
557 { 557 {
558 daemon->epoll_upgrade_fd = setup_epoll_fd (daemon); 558 daemon->epoll_upgrade_fd = setup_epoll_fd (daemon);
559 if (MHD_INVALID_SOCKET == daemon->epoll_upgrade_fd) 559 if (MHD_INVALID_SOCKET == daemon->epoll_upgrade_fd)
560 return MHD_NO; 560 return MHD_SC_EPOLL_CTL_CREATE_FAILED;
561 } 561 }
562#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 562#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
563 if ( (MHD_INVALID_SOCKET == (ls = daemon->listen_socket)) || 563 if ( (MHD_INVALID_SOCKET == (ls = daemon->listen_socket)) ||
564 (daemon->was_quiesced) ) 564 (daemon->was_quiesced) )
565 return MHD_YES; /* non-listening daemon */ 565 return MHD_SC_OK; /* non-listening daemon */
566 event.events = EPOLLIN; 566 event.events = EPOLLIN;
567 event.data.ptr = daemon; 567 event.data.ptr = daemon;
568 if (0 != epoll_ctl (daemon->epoll_fd, 568 if (0 != epoll_ctl (daemon->epoll_fd,
@@ -576,7 +576,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
576 _("Call to epoll_ctl failed: %s\n"), 576 _("Call to epoll_ctl failed: %s\n"),
577 MHD_socket_last_strerr_ ()); 577 MHD_socket_last_strerr_ ());
578#endif 578#endif
579 return MHD_NO; 579 return MHD_SC_EPOLL_CTL_ADD_FAILED;
580 } 580 }
581 daemon->listen_socket_in_epoll = true; 581 daemon->listen_socket_in_epoll = true;
582 if (MHD_ITC_IS_VALID_(daemon->itc)) 582 if (MHD_ITC_IS_VALID_(daemon->itc))
@@ -594,7 +594,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
594 _("Call to epoll_ctl failed: %s\n"), 594 _("Call to epoll_ctl failed: %s\n"),
595 MHD_socket_last_strerr_ ()); 595 MHD_socket_last_strerr_ ());
596#endif 596#endif
597 return MHD_NO; 597 return MHD_SC_EPOLL_CTL_ADD_FAILED;
598 } 598 }
599 } 599 }
600 return MHD_SC_OK; 600 return MHD_SC_OK;