libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit af91748032f4e418adac004980160708e9323260
parent 64e1480540f86081d900592b4940d5edc42ff739
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 18 Nov 2018 12:02:10 +0100

fix format string, prefer snprintf

Diffstat:
Mpo/libmicrohttpd.pot | 213++++++++++++++++++++++++++++++++++++++++---------------------------------------
Msrc/testcurl/test_digestauth_with_arguments.c | 64++++++++++++++++++++++++++++++++++------------------------------
2 files changed, 143 insertions(+), 134 deletions(-)

diff --git a/po/libmicrohttpd.pot b/po/libmicrohttpd.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: GNU libmicrohttpd 0.9.60\n" "Report-Msgid-Bugs-To: libmicrohttpd@gnu.org\n" -"POT-Creation-Date: 2018-11-06 19:47+0100\n" +"POT-Creation-Date: 2018-11-18 11:25+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -122,7 +122,7 @@ msgid "" "unsupported.\n" msgstr "" -#: src/microhttpd/daemon.c:1258 src/microhttpd/daemon.c:6314 +#: src/microhttpd/daemon.c:1258 src/microhttpd/daemon.c:6329 msgid "" "Initiated daemon shutdown while \"upgraded\" connection was not closed.\n" msgstr "" @@ -168,423 +168,428 @@ msgstr "" msgid "Internal server error. This should be impossible.\n" msgstr "" -#: src/microhttpd/daemon.c:2184 +#: src/microhttpd/daemon.c:2185 src/microhttpd/daemon.c:2213 msgid "PSK not supported by this server.\n" msgstr "" -#: src/microhttpd/daemon.c:2198 +#: src/microhttpd/daemon.c:2199 msgid "PSK authentication failed: gnutls_malloc failed to allocate memory\n" msgstr "" -#: src/microhttpd/daemon.c:2283 src/microhttpd/daemon.c:5983 +#: src/microhttpd/daemon.c:2291 src/microhttpd/daemon.c:5998 #, c-format msgid "Socket descriptor larger than FD_SETSIZE: %d > %d\n" msgstr "" -#: src/microhttpd/daemon.c:2299 +#: src/microhttpd/daemon.c:2307 #, c-format msgid "Failed to set SO_NOSIGPIPE on accepted socket: %s\n" msgstr "" -#: src/microhttpd/daemon.c:2316 src/microhttpd/daemon.c:3092 +#: src/microhttpd/daemon.c:2324 src/microhttpd/daemon.c:3100 #, c-format msgid "Accepted connection on socket %d\n" msgstr "" -#: src/microhttpd/daemon.c:2328 src/microhttpd/daemon.c:2504 +#: src/microhttpd/daemon.c:2336 src/microhttpd/daemon.c:2512 msgid "Server reached connection limit. Closing inbound connection.\n" msgstr "" -#: src/microhttpd/daemon.c:2346 +#: src/microhttpd/daemon.c:2354 msgid "Connection rejected by application. Closing connection.\n" msgstr "" -#: src/microhttpd/daemon.c:2379 src/microhttpd/daemon.c:2399 -#: src/microhttpd/daemon.c:3670 +#: src/microhttpd/daemon.c:2387 src/microhttpd/daemon.c:2407 +#: src/microhttpd/daemon.c:3678 #, c-format msgid "Error allocating memory: %s\n" msgstr "" -#: src/microhttpd/daemon.c:2461 +#: src/microhttpd/daemon.c:2469 #, c-format msgid "Failed to setup TLS credentials: unknown credential type %d\n" msgstr "" -#: src/microhttpd/daemon.c:2470 +#: src/microhttpd/daemon.c:2478 msgid "Unknown credential type" msgstr "" -#: src/microhttpd/daemon.c:2566 src/microhttpd/daemon.c:4159 -#: src/microhttpd/daemon.c:4192 src/microhttpd/daemon.c:5299 -#: src/microhttpd/daemon.c:5316 src/microhttpd/connection.c:3828 -#: src/microhttpd/response.c:934 src/microhttpd/response.c:960 +#: src/microhttpd/daemon.c:2574 src/microhttpd/daemon.c:4167 +#: src/microhttpd/daemon.c:4200 src/microhttpd/daemon.c:5314 +#: src/microhttpd/daemon.c:5331 src/microhttpd/connection.c:3828 +#: src/microhttpd/response.c:962 src/microhttpd/response.c:988 #, c-format msgid "Call to epoll_ctl failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:2591 +#: src/microhttpd/daemon.c:2599 msgid "Failed to signal new connection via inter-thread communication channel." msgstr "" -#: src/microhttpd/daemon.c:2688 src/microhttpd/daemon.c:3173 -#: src/microhttpd/daemon.c:6216 src/microhttpd/connection.c:990 +#: src/microhttpd/daemon.c:2696 src/microhttpd/daemon.c:3181 +#: src/microhttpd/daemon.c:6231 src/microhttpd/connection.c:990 #: src/microhttpd/connection.c:1009 msgid "Failed to remove FD from epoll set\n" msgstr "" -#: src/microhttpd/daemon.c:2735 +#: src/microhttpd/daemon.c:2743 msgid "Cannot suspend connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n" msgstr "" -#: src/microhttpd/daemon.c:2741 +#: src/microhttpd/daemon.c:2749 msgid "Error: connection scheduled for \"upgrade\" cannot be suspended" msgstr "" -#: src/microhttpd/daemon.c:2764 +#: src/microhttpd/daemon.c:2772 msgid "Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n" msgstr "" -#: src/microhttpd/daemon.c:2774 +#: src/microhttpd/daemon.c:2782 msgid "Failed to signal resume via inter-thread communication channel." msgstr "" -#: src/microhttpd/daemon.c:2902 +#: src/microhttpd/daemon.c:2910 msgid "" "Failed to signal resume of connection via inter-thread communication channel." msgstr "" -#: src/microhttpd/daemon.c:2948 +#: src/microhttpd/daemon.c:2956 #, c-format msgid "Failed to set nonblocking mode on new client socket: %s\n" msgstr "" -#: src/microhttpd/daemon.c:2961 +#: src/microhttpd/daemon.c:2969 msgid "Failed to set noninheritable mode on new client socket.\n" msgstr "" -#: src/microhttpd/daemon.c:3034 +#: src/microhttpd/daemon.c:3042 #, c-format msgid "Error accepting connection: %s\n" msgstr "" -#: src/microhttpd/daemon.c:3051 +#: src/microhttpd/daemon.c:3059 msgid "" "Hit process or system resource limit at FIRST connection. This is really bad " "as there is no sane way to proceed. Will try busy waiting for system " "resources to become magically available.\n" msgstr "" -#: src/microhttpd/daemon.c:3061 +#: src/microhttpd/daemon.c:3069 #, c-format msgid "" "Hit process or system resource limit at %u connections, temporarily " "suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n" msgstr "" -#: src/microhttpd/daemon.c:3073 +#: src/microhttpd/daemon.c:3081 #, c-format msgid "Failed to set nonblocking mode on incoming connection socket: %s\n" msgstr "" -#: src/microhttpd/daemon.c:3085 +#: src/microhttpd/daemon.c:3093 msgid "Failed to set noninheritable mode on incoming connection socket.\n" msgstr "" -#: src/microhttpd/daemon.c:3131 src/microhttpd/daemon.c:6355 -#: src/microhttpd/daemon.c:6385 src/microhttpd/daemon.c:6479 +#: src/microhttpd/daemon.c:3139 src/microhttpd/daemon.c:6370 +#: src/microhttpd/daemon.c:6400 src/microhttpd/daemon.c:6494 msgid "Failed to join a thread\n" msgstr "" -#: src/microhttpd/daemon.c:3230 +#: src/microhttpd/daemon.c:3238 msgid "Illegal call to MHD_get_timeout\n" msgstr "" -#: src/microhttpd/daemon.c:3427 +#: src/microhttpd/daemon.c:3435 msgid "" "MHD_run_from_select() called with except_fd_set set to NULL. Such behavior " "is deprecated.\n" msgstr "" -#: src/microhttpd/daemon.c:3507 +#: src/microhttpd/daemon.c:3515 msgid "Could not obtain daemon fdsets" msgstr "" -#: src/microhttpd/daemon.c:3524 +#: src/microhttpd/daemon.c:3532 msgid "Could not add listen socket to fdset" msgstr "" -#: src/microhttpd/daemon.c:3552 +#: src/microhttpd/daemon.c:3560 msgid "Could not add control inter-thread communication channel FD to fdset" msgstr "" -#: src/microhttpd/daemon.c:3608 +#: src/microhttpd/daemon.c:3616 #, c-format msgid "select failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:3752 src/microhttpd/daemon.c:3898 +#: src/microhttpd/daemon.c:3760 src/microhttpd/daemon.c:3906 #, c-format msgid "poll failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:4028 src/microhttpd/daemon.c:4259 +#: src/microhttpd/daemon.c:4036 src/microhttpd/daemon.c:4267 #, c-format msgid "Call to epoll_wait failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:4211 src/microhttpd/daemon.c:4661 +#: src/microhttpd/daemon.c:4219 src/microhttpd/daemon.c:4669 msgid "Failed to remove listen FD from epoll set\n" msgstr "" -#: src/microhttpd/daemon.c:4669 +#: src/microhttpd/daemon.c:4677 msgid "Failed to signal quiesce via inter-thread communication channel" msgstr "" -#: src/microhttpd/daemon.c:4690 +#: src/microhttpd/daemon.c:4698 msgid "failed to signal quiesce via inter-thread communication channel" msgstr "" -#: src/microhttpd/daemon.c:4795 +#: src/microhttpd/daemon.c:4803 msgid "Warning: Too large timeout value, ignored.\n" msgstr "" -#: src/microhttpd/daemon.c:4835 +#: src/microhttpd/daemon.c:4843 msgid "" "Warning: Zero size, specified for thread pool size, is ignored. Thread pool " "is not used.\n" msgstr "" -#: src/microhttpd/daemon.c:4843 +#: src/microhttpd/daemon.c:4851 msgid "" "Warning: \"1\", specified for thread pool size, is ignored. Thread pool is " "not used.\n" msgstr "" -#: src/microhttpd/daemon.c:4855 +#: src/microhttpd/daemon.c:4863 #, c-format msgid "Specified thread pool size (%u) too big\n" msgstr "" -#: src/microhttpd/daemon.c:4866 +#: src/microhttpd/daemon.c:4874 msgid "" "MHD_OPTION_THREAD_POOL_SIZE option is specified but " "MHD_USE_INTERNAL_POLLING_THREAD flag is not specified.\n" msgstr "" -#: src/microhttpd/daemon.c:4875 +#: src/microhttpd/daemon.c:4883 msgid "" "Both MHD_OPTION_THREAD_POOL_SIZE option and MHD_USE_THREAD_PER_CONNECTION " "flag are specified.\n" msgstr "" -#: src/microhttpd/daemon.c:4890 src/microhttpd/daemon.c:4901 -#: src/microhttpd/daemon.c:4912 src/microhttpd/daemon.c:4923 -#: src/microhttpd/daemon.c:4965 +#: src/microhttpd/daemon.c:4898 src/microhttpd/daemon.c:4909 +#: src/microhttpd/daemon.c:4920 src/microhttpd/daemon.c:4931 +#: src/microhttpd/daemon.c:4973 #, c-format msgid "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set\n" msgstr "" -#: src/microhttpd/daemon.c:4942 +#: src/microhttpd/daemon.c:4950 msgid "Error initializing DH parameters\n" msgstr "" -#: src/microhttpd/daemon.c:4954 +#: src/microhttpd/daemon.c:4962 msgid "Bad Diffie-Hellman parameters format\n" msgstr "" -#: src/microhttpd/daemon.c:4982 +#: src/microhttpd/daemon.c:4990 #, c-format msgid "Setting priorities to `%s' failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:4995 +#: src/microhttpd/daemon.c:5003 msgid "" "MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n" msgstr "" -#: src/microhttpd/daemon.c:5022 +#: src/microhttpd/daemon.c:5030 msgid "" "MHD_OPTION_LISTEN_SOCKET specified for daemon with MHD_USE_NO_LISTEN_SOCKET " "flag set.\n" msgstr "" -#: src/microhttpd/daemon.c:5069 +#: src/microhttpd/daemon.c:5077 msgid "" "Flag MHD_USE_PEDANTIC_CHECKS is ignored because another behavior is " "specified by MHD_OPTION_STRICT_CLIENT.\n" msgstr "" -#: src/microhttpd/daemon.c:5207 +#: src/microhttpd/daemon.c:5209 +#, c-format +msgid "MHD HTTPS option %d passed to MHD compiled without GNUtls >= 3\n" +msgstr "" + +#: src/microhttpd/daemon.c:5222 #, c-format msgid "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n" msgstr "" -#: src/microhttpd/daemon.c:5213 +#: src/microhttpd/daemon.c:5228 #, c-format msgid "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n" msgstr "" -#: src/microhttpd/daemon.c:5243 +#: src/microhttpd/daemon.c:5258 #, c-format msgid "Call to epoll_create1 failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5253 +#: src/microhttpd/daemon.c:5268 msgid "Failed to set noninheritable mode on epoll FD.\n" msgstr "" -#: src/microhttpd/daemon.c:5494 +#: src/microhttpd/daemon.c:5509 msgid "" "Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " "MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was " "added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n" msgstr "" -#: src/microhttpd/daemon.c:5542 +#: src/microhttpd/daemon.c:5557 msgid "Using debug build of libmicrohttpd.\n" msgstr "" -#: src/microhttpd/daemon.c:5553 +#: src/microhttpd/daemon.c:5568 #, c-format msgid "Failed to create inter-thread communication channel: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5569 +#: src/microhttpd/daemon.c:5584 msgid "" "file descriptor for inter-thread communication channel exceeds maximum " "value\n" msgstr "" -#: src/microhttpd/daemon.c:5589 +#: src/microhttpd/daemon.c:5604 msgid "Specified value for NC_SIZE too large\n" msgstr "" -#: src/microhttpd/daemon.c:5603 +#: src/microhttpd/daemon.c:5618 #, c-format msgid "Failed to allocate memory for nonce-nc map: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5619 +#: src/microhttpd/daemon.c:5634 msgid "MHD failed to initialize nonce-nc mutex\n" msgstr "" -#: src/microhttpd/daemon.c:5637 +#: src/microhttpd/daemon.c:5652 msgid "MHD thread pooling only works with MHD_USE_INTERNAL_POLLING_THREAD\n" msgstr "" -#: src/microhttpd/daemon.c:5661 +#: src/microhttpd/daemon.c:5676 #, c-format msgid "Failed to create socket for listening: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5682 src/microhttpd/daemon.c:5701 -#: src/microhttpd/daemon.c:5724 src/microhttpd/daemon.c:5761 -#: src/microhttpd/daemon.c:5838 src/microhttpd/daemon.c:5869 +#: src/microhttpd/daemon.c:5697 src/microhttpd/daemon.c:5716 +#: src/microhttpd/daemon.c:5739 src/microhttpd/daemon.c:5776 +#: src/microhttpd/daemon.c:5853 src/microhttpd/daemon.c:5884 #, c-format msgid "setsockopt failed: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5734 +#: src/microhttpd/daemon.c:5749 msgid "Cannot allow listening address reuse: SO_REUSEPORT not defined\n" msgstr "" -#: src/microhttpd/daemon.c:5769 +#: src/microhttpd/daemon.c:5784 msgid "" "Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n" msgstr "" -#: src/microhttpd/daemon.c:5849 +#: src/microhttpd/daemon.c:5864 #, c-format msgid "Failed to bind to port %u: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5880 +#: src/microhttpd/daemon.c:5895 #, c-format msgid "Failed to listen for connections: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5907 +#: src/microhttpd/daemon.c:5922 #, c-format msgid "Failed to get listen port number: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5917 +#: src/microhttpd/daemon.c:5932 msgid "" "Failed to get listen port number (`struct sockaddr_storage` too small!?)\n" msgstr "" -#: src/microhttpd/daemon.c:5950 +#: src/microhttpd/daemon.c:5965 msgid "Unknown address family!\n" msgstr "" -#: src/microhttpd/daemon.c:5963 +#: src/microhttpd/daemon.c:5978 #, c-format msgid "Failed to set nonblocking mode on listening socket: %s\n" msgstr "" -#: src/microhttpd/daemon.c:5999 +#: src/microhttpd/daemon.c:6014 msgid "" "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n" msgstr "" -#: src/microhttpd/daemon.c:6012 src/microhttpd/daemon.c:6025 +#: src/microhttpd/daemon.c:6027 src/microhttpd/daemon.c:6040 msgid "MHD failed to initialize IP connection limit mutex\n" msgstr "" -#: src/microhttpd/daemon.c:6041 +#: src/microhttpd/daemon.c:6056 msgid "Failed to initialize TLS support\n" msgstr "" -#: src/microhttpd/daemon.c:6065 +#: src/microhttpd/daemon.c:6080 #, c-format msgid "Failed to create listen thread: %s\n" msgstr "" -#: src/microhttpd/daemon.c:6113 +#: src/microhttpd/daemon.c:6128 #, c-format msgid "Failed to create worker inter-thread communication channel: %s\n" msgstr "" -#: src/microhttpd/daemon.c:6124 +#: src/microhttpd/daemon.c:6139 msgid "" "File descriptor for worker inter-thread communication channel exceeds " "maximum value\n" msgstr "" -#: src/microhttpd/daemon.c:6149 +#: src/microhttpd/daemon.c:6164 msgid "MHD failed to initialize cleanup connection mutex\n" msgstr "" -#: src/microhttpd/daemon.c:6163 +#: src/microhttpd/daemon.c:6178 #, c-format msgid "Failed to create pool thread: %s\n" msgstr "" -#: src/microhttpd/daemon.c:6301 src/microhttpd/daemon.c:6332 +#: src/microhttpd/daemon.c:6316 src/microhttpd/daemon.c:6347 msgid "MHD_stop_daemon() called while we have suspended connections.\n" msgstr "" -#: src/microhttpd/daemon.c:6341 src/microhttpd/daemon.c:6461 +#: src/microhttpd/daemon.c:6356 src/microhttpd/daemon.c:6476 msgid "Failed to signal shutdown via inter-thread communication channel" msgstr "" -#: src/microhttpd/daemon.c:6426 +#: src/microhttpd/daemon.c:6441 msgid "Failed to signal shutdown via inter-thread communication channel." msgstr "" -#: src/microhttpd/daemon.c:6877 +#: src/microhttpd/daemon.c:6892 msgid "Failed to initialize winsock\n" msgstr "" -#: src/microhttpd/daemon.c:6880 +#: src/microhttpd/daemon.c:6895 msgid "Winsock version 2.2 is not available\n" msgstr "" -#: src/microhttpd/daemon.c:6888 src/microhttpd/daemon.c:6892 +#: src/microhttpd/daemon.c:6903 src/microhttpd/daemon.c:6907 msgid "Failed to initialise multithreading in libgcrypt\n" msgstr "" -#: src/microhttpd/daemon.c:6897 +#: src/microhttpd/daemon.c:6912 msgid "libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n" msgstr "" @@ -727,26 +732,26 @@ msgstr "" msgid "Application used invalid status code for 'upgrade' response!\n" msgstr "" -#: src/microhttpd/response.c:796 +#: src/microhttpd/response.c:824 msgid "" "Invalid response for upgrade: application failed to set the 'Upgrade' " "header!\n" msgstr "" -#: src/microhttpd/response.c:837 +#: src/microhttpd/response.c:865 msgid "Failed to make loopback sockets non-blocking.\n" msgstr "" -#: src/microhttpd/response.c:856 +#: src/microhttpd/response.c:884 msgid "Failed to set SO_NOSIGPIPE on loopback sockets.\n" msgstr "" -#: src/microhttpd/response.c:876 +#: src/microhttpd/response.c:904 #, c-format msgid "Socketpair descriptor larger than FD_SETSIZE: %d > %d\n" msgstr "" -#: src/microhttpd/response.c:957 +#: src/microhttpd/response.c:985 msgid "Error cleaning up while handling epoll error" msgstr "" diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c @@ -90,39 +90,39 @@ ahc_echo (void *cls, if ( (username == NULL) || (0 != strcmp (username, "testuser")) ) { - response = MHD_create_response_from_buffer(strlen (DENIED), + response = MHD_create_response_from_buffer(strlen (DENIED), DENIED, - MHD_RESPMEM_PERSISTENT); + MHD_RESPMEM_PERSISTENT); ret = MHD_queue_auth_fail_response(connection, realm, MY_OPAQUE, response, - MHD_NO); - MHD_destroy_response(response); + MHD_NO); + MHD_destroy_response(response); return ret; } ret = MHD_digest_auth_check(connection, realm, - username, - password, + username, + password, 300); free(username); if ( (ret == MHD_INVALID_NONCE) || (ret == MHD_NO) ) { - response = MHD_create_response_from_buffer(strlen (DENIED), + response = MHD_create_response_from_buffer(strlen (DENIED), DENIED, - MHD_RESPMEM_PERSISTENT); - if (NULL == response) + MHD_RESPMEM_PERSISTENT); + if (NULL == response) return MHD_NO; ret = MHD_queue_auth_fail_response(connection, realm, MY_OPAQUE, response, - (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); - MHD_destroy_response(response); + (ret == MHD_INVALID_NONCE) ? MHD_YES : MHD_NO); + MHD_destroy_response(response); return ret; } response = MHD_create_response_from_buffer(strlen(PAGE), PAGE, MHD_RESPMEM_PERSISTENT); - ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); MHD_destroy_response(response); return ret; } @@ -157,24 +157,25 @@ testDigestAuth () fd = open("/dev/urandom", O_RDONLY); if (-1 == fd) { - fprintf(stderr, "Failed to open `%s': %s\n", - "/dev/urandom", - strerror(errno)); - return 1; - } + fprintf(stderr, "Failed to open `%s': %s\n", + "/dev/urandom", + strerror(errno)); + return 1; + } while (off < 8) - { - len = read(fd, rnd, 8); - if (len == (size_t)-1) - { - fprintf(stderr, "Failed to read `%s': %s\n", - "/dev/urandom", - strerror(errno)); - (void) close(fd); - return 1; - } - off += len; - } + { + len = read(fd, rnd, 8); + if (len == (size_t)-1) + { + fprintf(stderr, + "Failed to read `%s': %s\n", + "/dev/urandom", + strerror(errno)); + (void) close(fd); + return 1; + } + off += len; + } (void) close(fd); #else { @@ -213,7 +214,10 @@ testDigestAuth () { MHD_stop_daemon (d); return 32; } port = (int)dinfo->port; } - sprintf(url, "http://127.0.0.1:%d/bar%20foo%3Fkey%3Dvalue", port); + snprintf (url, + sizeof (url), + "http://127.0.0.1:%d/bar%%20foo%%3Fkey%%3Dvalue", + port); c = curl_easy_init (); curl_easy_setopt (c, CURLOPT_URL, url); curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);