diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-19 15:52:05 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-19 16:23:22 +0300 |
commit | 0b22e20357dad582e4b7a7a45b6e68102fb27b43 (patch) | |
tree | 4934c14d5a465e7d53cc383e707567f283a7b880 | |
parent | 69c600bd8510c3ec94f1f4ca8557e42832d6c142 (diff) | |
download | libmicrohttpd-0b22e20357dad582e4b7a7a45b6e68102fb27b43.tar.gz libmicrohttpd-0b22e20357dad582e4b7a7a45b6e68102fb27b43.zip |
log messaged-related minor fixes
-rw-r--r-- | src/microhttpd/connection.c | 36 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 17 |
2 files changed, 28 insertions, 25 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 3eaa2935..309683b8 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -798,6 +798,7 @@ connection_close_error (struct MHD_Connection *connection, | |||
798 | #ifdef HAVE_MESSAGES | 798 | #ifdef HAVE_MESSAGES |
799 | if (NULL != emsg) | 799 | if (NULL != emsg) |
800 | MHD_DLOG (connection->daemon, | 800 | MHD_DLOG (connection->daemon, |
801 | "%s\n", | ||
801 | emsg); | 802 | emsg); |
802 | #else /* ! HAVE_MESSAGES */ | 803 | #else /* ! HAVE_MESSAGES */ |
803 | (void) emsg; /* Mute compiler warning. */ | 804 | (void) emsg; /* Mute compiler warning. */ |
@@ -855,7 +856,7 @@ try_ready_normal_body (struct MHD_Connection *connection) | |||
855 | MHD_mutex_unlock_chk_ (&response->mutex); | 856 | MHD_mutex_unlock_chk_ (&response->mutex); |
856 | /* not enough memory */ | 857 | /* not enough memory */ |
857 | CONNECTION_CLOSE_ERROR (connection, | 858 | CONNECTION_CLOSE_ERROR (connection, |
858 | _ ("Closing connection (out of memory).\n")); | 859 | _ ("Closing connection (out of memory).")); |
859 | return MHD_NO; | 860 | return MHD_NO; |
860 | } | 861 | } |
861 | memcpy (connection->resp_iov.iov, | 862 | memcpy (connection->resp_iov.iov, |
@@ -900,7 +901,7 @@ try_ready_normal_body (struct MHD_Connection *connection) | |||
900 | else | 901 | else |
901 | CONNECTION_CLOSE_ERROR (connection, | 902 | CONNECTION_CLOSE_ERROR (connection, |
902 | _ ( | 903 | _ ( |
903 | "Closing connection (application reported error generating data).\n")); | 904 | "Closing connection (application reported error generating data).")); |
904 | return MHD_NO; | 905 | return MHD_NO; |
905 | } | 906 | } |
906 | response->data_start = connection->response_write_position; | 907 | response->data_start = connection->response_write_position; |
@@ -949,7 +950,7 @@ try_ready_chunked_body (struct MHD_Connection *connection) | |||
949 | #endif | 950 | #endif |
950 | /* not enough memory */ | 951 | /* not enough memory */ |
951 | CONNECTION_CLOSE_ERROR (connection, | 952 | CONNECTION_CLOSE_ERROR (connection, |
952 | _ ("Closing connection (out of memory).\n")); | 953 | _ ("Closing connection (out of memory).")); |
953 | return MHD_NO; | 954 | return MHD_NO; |
954 | } | 955 | } |
955 | if ( (2 * (0xFFFFFF + sizeof(cbuf) + 2)) < size) | 956 | if ( (2 * (0xFFFFFF + sizeof(cbuf) + 2)) < size) |
@@ -997,7 +998,7 @@ try_ready_chunked_body (struct MHD_Connection *connection) | |||
997 | #endif | 998 | #endif |
998 | CONNECTION_CLOSE_ERROR (connection, | 999 | CONNECTION_CLOSE_ERROR (connection, |
999 | _ ( | 1000 | _ ( |
1000 | "Closing connection (application error generating response).\n")); | 1001 | "Closing connection (application error generating response).")); |
1001 | return MHD_NO; | 1002 | return MHD_NO; |
1002 | } | 1003 | } |
1003 | if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) || | 1004 | if ( (((ssize_t) MHD_CONTENT_READER_END_OF_STREAM) == ret) || |
@@ -1667,7 +1668,7 @@ transmit_error_response (struct MHD_Connection *connection, | |||
1667 | /* can't even send a reply, at least close the connection */ | 1668 | /* can't even send a reply, at least close the connection */ |
1668 | CONNECTION_CLOSE_ERROR (connection, | 1669 | CONNECTION_CLOSE_ERROR (connection, |
1669 | _ ( | 1670 | _ ( |
1670 | "Closing connection (failed to queue response).\n")); | 1671 | "Closing connection (failed to queue response).")); |
1671 | return; | 1672 | return; |
1672 | } | 1673 | } |
1673 | mhd_assert (NULL != connection->response); | 1674 | mhd_assert (NULL != connection->response); |
@@ -1678,7 +1679,7 @@ transmit_error_response (struct MHD_Connection *connection, | |||
1678 | /* oops - close! */ | 1679 | /* oops - close! */ |
1679 | CONNECTION_CLOSE_ERROR (connection, | 1680 | CONNECTION_CLOSE_ERROR (connection, |
1680 | _ ( | 1681 | _ ( |
1681 | "Closing connection (failed to create response header).\n")); | 1682 | "Closing connection (failed to create response header).")); |
1682 | } | 1683 | } |
1683 | else | 1684 | else |
1684 | { | 1685 | { |
@@ -2220,7 +2221,7 @@ call_connection_handler (struct MHD_Connection *connection) | |||
2220 | /* serious internal error, close connection */ | 2221 | /* serious internal error, close connection */ |
2221 | CONNECTION_CLOSE_ERROR (connection, | 2222 | CONNECTION_CLOSE_ERROR (connection, |
2222 | _ ( | 2223 | _ ( |
2223 | "Application reported internal error, closing connection.\n")); | 2224 | "Application reported internal error, closing connection.")); |
2224 | return; | 2225 | return; |
2225 | } | 2226 | } |
2226 | } | 2227 | } |
@@ -2289,7 +2290,7 @@ process_request_body (struct MHD_Connection *connection) | |||
2289 | /* malformed encoding */ | 2290 | /* malformed encoding */ |
2290 | CONNECTION_CLOSE_ERROR (connection, | 2291 | CONNECTION_CLOSE_ERROR (connection, |
2291 | _ ( | 2292 | _ ( |
2292 | "Received malformed HTTP request (bad chunked encoding). Closing connection.\n")); | 2293 | "Received malformed HTTP request (bad chunked encoding). Closing connection.")); |
2293 | return; | 2294 | return; |
2294 | } | 2295 | } |
2295 | available -= i; | 2296 | available -= i; |
@@ -2368,7 +2369,7 @@ process_request_body (struct MHD_Connection *connection) | |||
2368 | /* malformed encoding */ | 2369 | /* malformed encoding */ |
2369 | CONNECTION_CLOSE_ERROR (connection, | 2370 | CONNECTION_CLOSE_ERROR (connection, |
2370 | _ ( | 2371 | _ ( |
2371 | "Received malformed HTTP request (bad chunked encoding). Closing connection.\n")); | 2372 | "Received malformed HTTP request (bad chunked encoding). Closing connection.")); |
2372 | return; | 2373 | return; |
2373 | } | 2374 | } |
2374 | /* skip 2nd part of line feed */ | 2375 | /* skip 2nd part of line feed */ |
@@ -2424,7 +2425,7 @@ process_request_body (struct MHD_Connection *connection) | |||
2424 | /* serious internal error, close connection */ | 2425 | /* serious internal error, close connection */ |
2425 | CONNECTION_CLOSE_ERROR (connection, | 2426 | CONNECTION_CLOSE_ERROR (connection, |
2426 | _ ( | 2427 | _ ( |
2427 | "Application reported internal error, closing connection.\n")); | 2428 | "Application reported internal error, closing connection.")); |
2428 | return; | 2429 | return; |
2429 | } | 2430 | } |
2430 | if (left_unprocessed > to_be_processed) | 2431 | if (left_unprocessed > to_be_processed) |
@@ -2522,7 +2523,7 @@ process_header_line (struct MHD_Connection *connection, | |||
2522 | /* error in header line, die hard */ | 2523 | /* error in header line, die hard */ |
2523 | CONNECTION_CLOSE_ERROR (connection, | 2524 | CONNECTION_CLOSE_ERROR (connection, |
2524 | _ ( | 2525 | _ ( |
2525 | "Received malformed line (no colon). Closing connection.\n")); | 2526 | "Received malformed line (no colon). Closing connection.")); |
2526 | return MHD_NO; | 2527 | return MHD_NO; |
2527 | } | 2528 | } |
2528 | if (-1 >= connection->daemon->strict_for_client) | 2529 | if (-1 >= connection->daemon->strict_for_client) |
@@ -2697,7 +2698,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
2697 | /* can't even send a reply, at least close the connection */ | 2698 | /* can't even send a reply, at least close the connection */ |
2698 | CONNECTION_CLOSE_ERROR (connection, | 2699 | CONNECTION_CLOSE_ERROR (connection, |
2699 | _ ( | 2700 | _ ( |
2700 | "Closing connection (failed to create response).\n")); | 2701 | "Closing connection (failed to create response).")); |
2701 | return; | 2702 | return; |
2702 | } | 2703 | } |
2703 | iret = MHD_queue_response (connection, | 2704 | iret = MHD_queue_response (connection, |
@@ -2709,7 +2710,7 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
2709 | /* can't even send a reply, at least close the connection */ | 2710 | /* can't even send a reply, at least close the connection */ |
2710 | CONNECTION_CLOSE_ERROR (connection, | 2711 | CONNECTION_CLOSE_ERROR (connection, |
2711 | _ ( | 2712 | _ ( |
2712 | "Closing connection (failed to queue response).\n")); | 2713 | "Closing connection (failed to queue response).")); |
2713 | } | 2714 | } |
2714 | return; | 2715 | return; |
2715 | } | 2716 | } |
@@ -2746,7 +2747,8 @@ parse_connection_headers (struct MHD_Connection *connection) | |||
2746 | connection->remaining_upload_size = 0; | 2747 | connection->remaining_upload_size = 0; |
2747 | #ifdef HAVE_MESSAGES | 2748 | #ifdef HAVE_MESSAGES |
2748 | MHD_DLOG (connection->daemon, | 2749 | MHD_DLOG (connection->daemon, |
2749 | "Failed to parse `Content-Length' header. Closing connection.\n"); | 2750 | _ ( |
2751 | "Failed to parse `Content-Length' header. Closing connection.\n")); | ||
2750 | #endif | 2752 | #endif |
2751 | CONNECTION_CLOSE_ERROR (connection, | 2753 | CONNECTION_CLOSE_ERROR (connection, |
2752 | NULL); | 2754 | NULL); |
@@ -2847,14 +2849,14 @@ MHD_connection_handle_read (struct MHD_Connection *connection) | |||
2847 | (MHD_CONNECTION_INIT == connection->state) ? | 2849 | (MHD_CONNECTION_INIT == connection->state) ? |
2848 | NULL : | 2850 | NULL : |
2849 | _ ( | 2851 | _ ( |
2850 | "Socket disconnected while reading request.\n")); | 2852 | "Socket disconnected while reading request.")); |
2851 | return; | 2853 | return; |
2852 | } | 2854 | } |
2853 | CONNECTION_CLOSE_ERROR (connection, | 2855 | CONNECTION_CLOSE_ERROR (connection, |
2854 | (MHD_CONNECTION_INIT == connection->state) ? | 2856 | (MHD_CONNECTION_INIT == connection->state) ? |
2855 | NULL : | 2857 | NULL : |
2856 | _ ( | 2858 | _ ( |
2857 | "Connection socket is closed due to error when reading request.\n")); | 2859 | "Connection socket is closed due to error when reading request.")); |
2858 | return; | 2860 | return; |
2859 | } | 2861 | } |
2860 | 2862 | ||
@@ -3689,7 +3691,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection) | |||
3689 | /* oops - close! */ | 3691 | /* oops - close! */ |
3690 | CONNECTION_CLOSE_ERROR (connection, | 3692 | CONNECTION_CLOSE_ERROR (connection, |
3691 | _ ( | 3693 | _ ( |
3692 | "Closing connection (failed to create response header).\n")); | 3694 | "Closing connection (failed to create response header).")); |
3693 | continue; | 3695 | continue; |
3694 | } | 3696 | } |
3695 | if ( (! connection->have_chunked_upload) || | 3697 | if ( (! connection->have_chunked_upload) || |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index b91278a9..8d721203 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -562,7 +562,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
562 | { | 562 | { |
563 | #ifdef HAVE_MESSAGES | 563 | #ifdef HAVE_MESSAGES |
564 | MHD_DLOG (daemon, | 564 | MHD_DLOG (daemon, |
565 | "Too long trust certificate.\n"); | 565 | _ ("Too long trust certificate.\n")); |
566 | #endif | 566 | #endif |
567 | return -1; | 567 | return -1; |
568 | } | 568 | } |
@@ -574,7 +574,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
574 | { | 574 | { |
575 | #ifdef HAVE_MESSAGES | 575 | #ifdef HAVE_MESSAGES |
576 | MHD_DLOG (daemon, | 576 | MHD_DLOG (daemon, |
577 | "Bad trust certificate format.\n"); | 577 | _ ("Bad trust certificate format.\n")); |
578 | #endif | 578 | #endif |
579 | return -1; | 579 | return -1; |
580 | } | 580 | } |
@@ -599,7 +599,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
599 | { | 599 | { |
600 | #ifdef HAVE_MESSAGES | 600 | #ifdef HAVE_MESSAGES |
601 | MHD_DLOG (daemon, | 601 | MHD_DLOG (daemon, |
602 | "Too long key or certificate.\n"); | 602 | _ ("Too long key or certificate.\n")); |
603 | #endif | 603 | #endif |
604 | return -1; | 604 | return -1; |
605 | } | 605 | } |
@@ -634,7 +634,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
634 | #ifdef HAVE_MESSAGES | 634 | #ifdef HAVE_MESSAGES |
635 | if (0 != ret) | 635 | if (0 != ret) |
636 | MHD_DLOG (daemon, | 636 | MHD_DLOG (daemon, |
637 | "GnuTLS failed to setup x509 certificate/key: %s\n", | 637 | _ ("GnuTLS failed to setup x509 certificate/key: %s\n"), |
638 | gnutls_strerror (ret)); | 638 | gnutls_strerror (ret)); |
639 | #endif | 639 | #endif |
640 | return ret; | 640 | return ret; |
@@ -649,7 +649,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon) | |||
649 | #endif | 649 | #endif |
650 | #ifdef HAVE_MESSAGES | 650 | #ifdef HAVE_MESSAGES |
651 | MHD_DLOG (daemon, | 651 | MHD_DLOG (daemon, |
652 | "You need to specify a certificate and key location.\n"); | 652 | _ ("You need to specify a certificate and key location.\n")); |
653 | #endif | 653 | #endif |
654 | return -1; | 654 | return -1; |
655 | } | 655 | } |
@@ -2447,7 +2447,7 @@ new_connection_prepare_ (struct MHD_Daemon *daemon, | |||
2447 | eno = errno; | 2447 | eno = errno; |
2448 | #ifdef HAVE_MESSAGES | 2448 | #ifdef HAVE_MESSAGES |
2449 | MHD_DLOG (daemon, | 2449 | MHD_DLOG (daemon, |
2450 | "Error allocating memory: %s\n", | 2450 | _ ("Error allocating memory: %s\n"), |
2451 | MHD_strerror_ (errno)); | 2451 | MHD_strerror_ (errno)); |
2452 | #endif | 2452 | #endif |
2453 | MHD_socket_close_chk_ (client_socket); | 2453 | MHD_socket_close_chk_ (client_socket); |
@@ -2754,7 +2754,7 @@ new_connection_process_ (struct MHD_Daemon *daemon, | |||
2754 | eno = errno; | 2754 | eno = errno; |
2755 | #ifdef HAVE_MESSAGES | 2755 | #ifdef HAVE_MESSAGES |
2756 | MHD_DLOG (daemon, | 2756 | MHD_DLOG (daemon, |
2757 | "Failed to create a thread: %s\n", | 2757 | _ ("Failed to create a thread: %s\n"), |
2758 | MHD_strerror_ (eno)); | 2758 | MHD_strerror_ (eno)); |
2759 | #endif | 2759 | #endif |
2760 | goto cleanup; | 2760 | goto cleanup; |
@@ -5355,7 +5355,8 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon) | |||
5355 | { | 5355 | { |
5356 | #ifdef HAVE_MESSAGES | 5356 | #ifdef HAVE_MESSAGES |
5357 | MHD_DLOG (daemon, | 5357 | MHD_DLOG (daemon, |
5358 | "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC.\n"); | 5358 | _ ( |
5359 | "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC.\n")); | ||
5359 | #endif | 5360 | #endif |
5360 | return MHD_INVALID_SOCKET; | 5361 | return MHD_INVALID_SOCKET; |
5361 | } | 5362 | } |