aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/uncrustify.cfg17
-rw-r--r--src/examples/authorization_example.c1
-rw-r--r--src/examples/benchmark.c1
-rw-r--r--src/examples/benchmark_https.c1
-rw-r--r--src/examples/chunked_example.c9
-rw-r--r--src/examples/connection_close.c1
-rw-r--r--src/examples/demo.c3
-rw-r--r--src/examples/demo_https.c3
-rw-r--r--src/examples/digest_auth_example.c1
-rw-r--r--src/examples/http_chunked_compression.c4
-rw-r--r--src/examples/http_compression.c3
-rw-r--r--src/examples/https_fileserver_example.c2
-rw-r--r--src/examples/minimal_example_comet.c2
-rw-r--r--src/examples/post_example.c3
-rw-r--r--src/examples/querystring_example.c1
-rw-r--r--src/examples/refuse_post_example.c2
-rw-r--r--src/gnutls/handshake.c1
-rw-r--r--src/gnutls/init.c1
-rw-r--r--src/gnutls/init.h1
-rw-r--r--src/include/mhd_options.h1
-rw-r--r--src/include/microhttpd.h4
-rw-r--r--src/include/microhttpd2.h7
-rw-r--r--src/include/microhttpd_tls.h1
-rw-r--r--src/lib/action_continue.c1
-rw-r--r--src/lib/action_from_response.c3
-rw-r--r--src/lib/action_parse_post.c2
-rw-r--r--src/lib/action_suspend.c1
-rw-r--r--src/lib/connection_add.c5
-rw-r--r--src/lib/connection_call_handlers.c31
-rw-r--r--src/lib/connection_cleanup.c6
-rw-r--r--src/lib/connection_close.c4
-rw-r--r--src/lib/connection_finish_forward.c5
-rw-r--r--src/lib/connection_info.c1
-rw-r--r--src/lib/connection_options.c1
-rw-r--r--src/lib/connection_update_last_activity.c1
-rw-r--r--src/lib/daemon_close_all_connections.c1
-rw-r--r--src/lib/daemon_destroy.c1
-rw-r--r--src/lib/daemon_epoll.c7
-rw-r--r--src/lib/daemon_get_timeout.c1
-rw-r--r--src/lib/daemon_info.c1
-rw-r--r--src/lib/daemon_ip_limit.c1
-rw-r--r--src/lib/daemon_poll.c6
-rw-r--r--src/lib/daemon_poll.h2
-rw-r--r--src/lib/daemon_quiesce.c5
-rw-r--r--src/lib/daemon_run.c1
-rw-r--r--src/lib/daemon_select.c8
-rw-r--r--src/lib/daemon_select.h1
-rw-r--r--src/lib/daemon_start.c2
-rw-r--r--src/lib/init.c3
-rw-r--r--src/lib/init.h1
-rw-r--r--src/lib/internal.c5
-rw-r--r--src/lib/internal.h8
-rw-r--r--src/lib/md5.c4
-rw-r--r--src/lib/mhd_byteorder.h2
-rw-r--r--src/lib/mhd_compat.c10
-rw-r--r--src/lib/mhd_compat.h2
-rw-r--r--src/lib/mhd_itc.c2
-rw-r--r--src/lib/mhd_itc.h1
-rw-r--r--src/lib/mhd_mono_clock.c1
-rw-r--r--src/lib/mhd_sockets.c4
-rw-r--r--src/lib/mhd_sockets.h1
-rw-r--r--src/lib/mhd_str.c43
-rw-r--r--src/lib/mhd_str.h1
-rw-r--r--src/lib/mhd_threads.c12
-rw-r--r--src/lib/response.c1
-rw-r--r--src/lib/response_for_upgrade.c1
-rw-r--r--src/lib/response_from_buffer.c1
-rw-r--r--src/lib/response_from_fd.c1
-rw-r--r--src/lib/tsearch.c3
-rw-r--r--src/lib/upgrade_process.c12
-rw-r--r--src/lib/version.c2
-rw-r--r--src/microhttpd/basicauth.c3
-rw-r--r--src/microhttpd/connection.c36
-rw-r--r--src/microhttpd/connection.h3
-rw-r--r--src/microhttpd/connection_https.c1
-rw-r--r--src/microhttpd/connection_https.h1
-rw-r--r--src/microhttpd/daemon.c71
-rw-r--r--src/microhttpd/digestauth.c19
-rw-r--r--src/microhttpd/internal.c5
-rw-r--r--src/microhttpd/internal.h3
-rw-r--r--src/microhttpd/md5.c1
-rw-r--r--src/microhttpd/memorypool.c1
-rw-r--r--src/microhttpd/mhd_byteorder.h2
-rw-r--r--src/microhttpd/mhd_compat.c10
-rw-r--r--src/microhttpd/mhd_compat.h2
-rw-r--r--src/microhttpd/mhd_itc.c2
-rw-r--r--src/microhttpd/mhd_itc.h1
-rw-r--r--src/microhttpd/mhd_mono_clock.c1
-rw-r--r--src/microhttpd/mhd_send.c6
-rw-r--r--src/microhttpd/mhd_send.h1
-rw-r--r--src/microhttpd/mhd_sockets.c6
-rw-r--r--src/microhttpd/mhd_sockets.h1
-rw-r--r--src/microhttpd/mhd_str.c44
-rw-r--r--src/microhttpd/mhd_str.h1
-rw-r--r--src/microhttpd/mhd_threads.c12
-rw-r--r--src/microhttpd/postprocessor.c4
-rw-r--r--src/microhttpd/response.c3
-rw-r--r--src/microhttpd/sha256.c2
-rw-r--r--src/microhttpd/test_helpers.h3
-rw-r--r--src/microhttpd/test_http_reasons.c35
-rw-r--r--src/microhttpd/test_options.c2
-rw-r--r--src/microhttpd/test_postprocessor.c3
-rw-r--r--src/microhttpd/test_postprocessor_amp.c9
-rw-r--r--src/microhttpd/test_postprocessor_large.c1
-rw-r--r--src/microhttpd/test_sha256.c2
-rw-r--r--src/microhttpd/test_shutdown_select.c6
-rw-r--r--src/microhttpd/test_start_stop.c3
-rw-r--r--src/microhttpd/test_str.c221
-rw-r--r--src/microhttpd/test_str_token.c13
-rw-r--r--src/microhttpd/test_upgrade.c17
-rw-r--r--src/microhttpd/test_upgrade_large.c17
-rw-r--r--src/microhttpd/tsearch.c3
-rw-r--r--src/testcurl/curl_version_check.c27
-rw-r--r--src/testcurl/https/test_empty_response.c10
-rw-r--r--src/testcurl/https/test_https_get.c8
-rw-r--r--src/testcurl/https/test_https_get_parallel_threads.c1
-rw-r--r--src/testcurl/https/test_https_get_select.c10
-rw-r--r--src/testcurl/https/test_https_multi_daemon.c4
-rw-r--r--src/testcurl/https/test_https_session_info.c4
-rw-r--r--src/testcurl/https/test_https_sni.c8
-rw-r--r--src/testcurl/https/test_https_time_out.c2
-rw-r--r--src/testcurl/https/test_tls_authentication.c3
-rw-r--r--src/testcurl/https/test_tls_extensions.c5
-rw-r--r--src/testcurl/https/tls_test_common.c8
-rw-r--r--src/testcurl/perf_get.c24
-rw-r--r--src/testcurl/perf_get_concurrent.c19
-rw-r--r--src/testcurl/test_callback.c9
-rw-r--r--src/testcurl/test_concurrent_stop.c14
-rw-r--r--src/testcurl/test_delete.c21
-rw-r--r--src/testcurl/test_digestauth_with_arguments.c3
-rw-r--r--src/testcurl/test_get.c27
-rw-r--r--src/testcurl/test_get_chunked.c20
-rw-r--r--src/testcurl/test_get_empty.c27
-rw-r--r--src/testcurl/test_get_response_cleanup.c10
-rw-r--r--src/testcurl/test_get_sendfile.c19
-rw-r--r--src/testcurl/test_iplimit.c10
-rw-r--r--src/testcurl/test_large_put.c40
-rw-r--r--src/testcurl/test_long_header.c9
-rw-r--r--src/testcurl/test_parse_cookies.c13
-rw-r--r--src/testcurl/test_post.c27
-rw-r--r--src/testcurl/test_post_loop.c14
-rw-r--r--src/testcurl/test_postform.c21
-rw-r--r--src/testcurl/test_process_arguments.c11
-rw-r--r--src/testcurl/test_process_headers.c23
-rw-r--r--src/testcurl/test_put.c22
-rw-r--r--src/testcurl/test_put_chunked.c20
-rw-r--r--src/testcurl/test_quiesce.c24
-rw-r--r--src/testcurl/test_quiesce_stream.c4
-rw-r--r--src/testcurl/test_termination.c4
-rw-r--r--src/testcurl/test_timeout.c7
-rw-r--r--src/testcurl/test_urlparse.c6
-rw-r--r--src/testzzuf/socat.c1
-rw-r--r--src/testzzuf/test_get.c2
-rw-r--r--src/testzzuf/test_get_chunked.c6
-rw-r--r--src/testzzuf/test_long_header.c2
-rw-r--r--src/testzzuf/test_post.c2
-rw-r--r--src/testzzuf/test_post_form.c2
-rw-r--r--src/testzzuf/test_put.c4
-rw-r--r--src/testzzuf/test_put_chunked.c4
-rw-r--r--src/testzzuf/test_put_large.c4
160 files changed, 902 insertions, 529 deletions
diff --git a/contrib/uncrustify.cfg b/contrib/uncrustify.cfg
index f56c8e73..8c9df2c4 100644
--- a/contrib/uncrustify.cfg
+++ b/contrib/uncrustify.cfg
@@ -49,8 +49,12 @@ nl_assign_brace=remove
49 49
50# No extra newlines that cause noisy diffs 50# No extra newlines that cause noisy diffs
51nl_start_of_file=remove 51nl_start_of_file=remove
52nl_after_func_proto = 2
53nl_after_func_body = 3
52# If there's no new line, it's not a text file! 54# If there's no new line, it's not a text file!
53nl_end_of_file=add 55nl_end_of_file=add
56nl_max_blank_in_func = 3
57nl_max = 3
54 58
55sp_inside_paren = remove 59sp_inside_paren = remove
56 60
@@ -69,6 +73,7 @@ sp_between_ptr_star = remove
69sp_before_sparen = add 73sp_before_sparen = add
70 74
71sp_inside_fparen = remove 75sp_inside_fparen = remove
76sp_inside_sparen = remove
72 77
73# add space before function call and decl: "foo (x)" 78# add space before function call and decl: "foo (x)"
74sp_func_call_paren = add 79sp_func_call_paren = add
@@ -76,3 +81,15 @@ sp_func_proto_paren = add
76sp_func_proto_paren_empty = add 81sp_func_proto_paren_empty = add
77sp_func_def_paren = add 82sp_func_def_paren = add
78sp_func_def_paren_empty = add 83sp_func_def_paren_empty = add
84
85# We'd want it for "if ( (foo) || (bar) )", but not for "if (m())",
86# so as uncrustify doesn't give exactly what we want => ignore
87sp_paren_paren = ignore
88sp_inside_paren = remove
89sp_bool = force
90
91nl_func_type_name = force
92#nl_branch_else = add
93nl_else_brace = add
94nl_elseif_brace = add
95nl_for_brace = add
diff --git a/src/examples/authorization_example.c b/src/examples/authorization_example.c
index c07d7827..40bffcb7 100644
--- a/src/examples/authorization_example.c
+++ b/src/examples/authorization_example.c
@@ -39,7 +39,6 @@
39 "<html><head><title>Access denied</title></head><body>Access denied</body></html>" 39 "<html><head><title>Access denied</title></head><body>Access denied</body></html>"
40 40
41 41
42
43static int 42static int
44ahc_echo (void *cls, 43ahc_echo (void *cls,
45 struct MHD_Connection *connection, 44 struct MHD_Connection *connection,
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index 2a8fb179..9b07e5c8 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -49,7 +49,6 @@ static unsigned int small_deltas[SMALL];
49static struct MHD_Response *response; 49static struct MHD_Response *response;
50 50
51 51
52
53/** 52/**
54 * Signature of the callback used by MHD to notify the 53 * Signature of the callback used by MHD to notify the
55 * application about completed requests. 54 * application about completed requests.
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index 9506e562..53b83e0a 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -49,7 +49,6 @@ static unsigned int small_deltas[SMALL];
49static struct MHD_Response *response; 49static struct MHD_Response *response;
50 50
51 51
52
53/** 52/**
54 * Signature of the callback used by MHD to notify the 53 * Signature of the callback used by MHD to notify the
55 * application about completed requests. 54 * application about completed requests.
diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index cd6539ef..9b2cb51c 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -57,9 +57,7 @@ callback (void *cls,
57 // Consider suspending connection until data will be ready. 57 // Consider suspending connection until data will be ready.
58 return 0; 58 return 0;
59 } 59 }
60 * End of pseudo code. */ 60 * End of pseudo code. */if (buf_size < (param->response_size - pos))
61
62 if (buf_size < (param->response_size - pos))
63 size_to_copy = buf_size; 61 size_to_copy = buf_size;
64 else 62 else
65 size_to_copy = param->response_size - pos; 63 size_to_copy = param->response_size - pos;
@@ -72,10 +70,7 @@ callback (void *cls,
72 // Close connection with error. 70 // Close connection with error.
73 return MHD_CONTENT_READER_END_WITH_ERROR; 71 return MHD_CONTENT_READER_END_WITH_ERROR;
74 } 72 }
75 * End of pseudo code. */ 73 * End of pseudo code. *//* Return amount of data copied to buffer. */return size_to_copy;
76
77 /* Return amount of data copied to buffer. */
78 return size_to_copy;
79} 74}
80 75
81 76
diff --git a/src/examples/connection_close.c b/src/examples/connection_close.c
index 43ee379f..fb9f77d9 100644
--- a/src/examples/connection_close.c
+++ b/src/examples/connection_close.c
@@ -62,6 +62,7 @@ ahc_echo (void *cls,
62 return ret; 62 return ret;
63} 63}
64 64
65
65#include <x86intrin.h> 66#include <x86intrin.h>
66 67
67static void 68static void
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 375f2a63..c7ad4b30 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -871,6 +871,8 @@ ignore_sigpipe ()
871 fprintf (stderr, 871 fprintf (stderr,
872 "Failed to install SIGPIPE handler: %s\n", strerror (errno)); 872 "Failed to install SIGPIPE handler: %s\n", strerror (errno));
873} 873}
874
875
874#endif 876#endif
875 877
876 878
@@ -958,4 +960,5 @@ main (int argc, char *const *argv)
958 return 0; 960 return 0;
959} 961}
960 962
963
961/* end of demo.c */ 964/* end of demo.c */
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 7f7eb3a5..7cd98b68 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -872,6 +872,8 @@ ignore_sigpipe (void)
872 fprintf (stderr, 872 fprintf (stderr,
873 "Failed to install SIGPIPE handler: %s\n", strerror (errno)); 873 "Failed to install SIGPIPE handler: %s\n", strerror (errno));
874} 874}
875
876
875#endif 877#endif
876 878
877/* test server key */ 879/* test server key */
@@ -1013,4 +1015,5 @@ main (int argc, char *const *argv)
1013 return 0; 1015 return 0;
1014} 1016}
1015 1017
1018
1016/* end of demo_https.c */ 1019/* end of demo_https.c */
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c
index 720576cd..25fb4086 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -149,4 +149,5 @@ main (int argc, char *const *argv)
149 return 0; 149 return 0;
150} 150}
151 151
152
152/* end of digest_auth_example.c */ 153/* end of digest_auth_example.c */
diff --git a/src/examples/http_chunked_compression.c b/src/examples/http_chunked_compression.c
index 461f4d3a..ba71923b 100644
--- a/src/examples/http_chunked_compression.c
+++ b/src/examples/http_chunked_compression.c
@@ -100,6 +100,7 @@ compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset,
100 return (Z_OK == ret) ? MHD_YES : MHD_NO; 100 return (Z_OK == ret) ? MHD_YES : MHD_NO;
101} 101}
102 102
103
103static ssize_t 104static ssize_t
104read_cb (void *cls, uint64_t pos, char *mem, size_t size) 105read_cb (void *cls, uint64_t pos, char *mem, size_t size)
105{ 106{
@@ -139,6 +140,7 @@ done:
139 return ret; 140 return ret;
140} 141}
141 142
143
142static void 144static void
143free_cb (void *cls) 145free_cb (void *cls)
144{ 146{
@@ -149,6 +151,7 @@ free_cb (void *cls)
149 free (holder); 151 free (holder);
150} 152}
151 153
154
152static int 155static int
153ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const 156ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const
154 char *method, const char *version, 157 char *method, const char *version,
@@ -207,6 +210,7 @@ file_error:
207 return MHD_NO; 210 return MHD_NO;
208} 211}
209 212
213
210int 214int
211main (int argc, char *const *argv) 215main (int argc, char *const *argv)
212{ 216{
diff --git a/src/examples/http_compression.c b/src/examples/http_compression.c
index af153f6e..f7d8db21 100644
--- a/src/examples/http_compression.c
+++ b/src/examples/http_compression.c
@@ -59,6 +59,7 @@ can_compress (struct MHD_Connection *con)
59 return MHD_NO; 59 return MHD_NO;
60} 60}
61 61
62
62static int 63static int
63body_compress (void **buf, 64body_compress (void **buf,
64 size_t *buf_size) 65 size_t *buf_size)
@@ -88,6 +89,7 @@ body_compress (void **buf,
88 return MHD_YES; 89 return MHD_YES;
89} 90}
90 91
92
91static int 93static int
92ahc_echo (void *cls, 94ahc_echo (void *cls,
93 struct MHD_Connection *connection, 95 struct MHD_Connection *connection,
@@ -156,6 +158,7 @@ ahc_echo (void *cls,
156 return ret; 158 return ret;
157} 159}
158 160
161
159int 162int
160main (int argc, char *const *argv) 163main (int argc, char *const *argv)
161{ 164{
diff --git a/src/examples/https_fileserver_example.c b/src/examples/https_fileserver_example.c
index cd7aa355..627bc739 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -103,6 +103,7 @@ file_reader (void *cls, uint64_t pos, char *buf, size_t max)
103 return fread (buf, 1, max, file); 103 return fread (buf, 1, max, file);
104} 104}
105 105
106
106static void 107static void
107file_free_callback (void *cls) 108file_free_callback (void *cls)
108{ 109{
@@ -110,6 +111,7 @@ file_free_callback (void *cls)
110 fclose (file); 111 fclose (file);
111} 112}
112 113
114
113/* HTTP access handler call back */ 115/* HTTP access handler call back */
114static int 116static int
115http_ahc (void *cls, 117http_ahc (void *cls,
diff --git a/src/examples/minimal_example_comet.c b/src/examples/minimal_example_comet.c
index 53f8f666..80c4258a 100644
--- a/src/examples/minimal_example_comet.c
+++ b/src/examples/minimal_example_comet.c
@@ -37,6 +37,7 @@ data_generator (void *cls, uint64_t pos, char *buf, size_t max)
37 return 80; 37 return 80;
38} 38}
39 39
40
40static int 41static int
41ahc_echo (void *cls, 42ahc_echo (void *cls,
42 struct MHD_Connection *connection, 43 struct MHD_Connection *connection,
@@ -71,6 +72,7 @@ ahc_echo (void *cls,
71 return ret; 72 return ret;
72} 73}
73 74
75
74int 76int
75main (int argc, char *const *argv) 77main (int argc, char *const *argv)
76{ 78{
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 311bf6c2..59b7fae7 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -143,8 +143,6 @@ struct Request
143static struct Session *sessions; 143static struct Session *sessions;
144 144
145 145
146
147
148/** 146/**
149 * Return the session handle for this connection, or 147 * Return the session handle for this connection, or
150 * create one if this is a new user. 148 * create one if this is a new user.
@@ -452,7 +450,6 @@ static struct Page pages[] = {
452}; 450};
453 451
454 452
455
456/** 453/**
457 * Iterator over key-value pairs where the value 454 * Iterator over key-value pairs where the value
458 * maybe made available in increments and/or may 455 * maybe made available in increments and/or may
diff --git a/src/examples/querystring_example.c b/src/examples/querystring_example.c
index a8f0f572..8abd8596 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -74,6 +74,7 @@ ahc_echo (void *cls,
74 return ret; 74 return ret;
75} 75}
76 76
77
77int 78int
78main (int argc, char *const *argv) 79main (int argc, char *const *argv)
79{ 80{
diff --git a/src/examples/refuse_post_example.c b/src/examples/refuse_post_example.c
index 9241ce43..3a34f36d 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -83,6 +83,7 @@ ahc_echo (void *cls,
83 return ret; 83 return ret;
84} 84}
85 85
86
86int 87int
87main (int argc, char *const *argv) 88main (int argc, char *const *argv)
88{ 89{
@@ -105,4 +106,5 @@ main (int argc, char *const *argv)
105 return 0; 106 return 0;
106} 107}
107 108
109
108/* end of refuse_post_example.c */ 110/* end of refuse_post_example.c */
diff --git a/src/gnutls/handshake.c b/src/gnutls/handshake.c
index 8970ad8a..1de4dc3d 100644
--- a/src/gnutls/handshake.c
+++ b/src/gnutls/handshake.c
@@ -3,7 +3,6 @@ enum MHD_Bool
3 struct MHD_TLS_ConnectionState *cs) : 3 struct MHD_TLS_ConnectionState *cs) :
4 4
5 5
6
7 if (MHD_TLS_CONN_NO_TLS != connection->tls_state) 6 if (MHD_TLS_CONN_NO_TLS != connection->tls_state)
8{ /* HTTPS connection. */ 7{ /* HTTPS connection. */
9 if (MHD_TLS_CONN_CONNECTED > connection->tls_state) 8 if (MHD_TLS_CONN_CONNECTED > connection->tls_state)
diff --git a/src/gnutls/init.c b/src/gnutls/init.c
index 321e7e6a..401172fc 100644
--- a/src/gnutls/init.c
+++ b/src/gnutls/init.c
@@ -157,6 +157,7 @@ MHD_TLS_fini (void)
157 gnutls_global_deinit (); 157 gnutls_global_deinit ();
158} 158}
159 159
160
160#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED 161#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
161_SET_INIT_AND_DEINIT_FUNCS (MHD_TLS_init, MHD_TLS_fini); 162_SET_INIT_AND_DEINIT_FUNCS (MHD_TLS_init, MHD_TLS_fini);
162#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */ 163#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */
diff --git a/src/gnutls/init.h b/src/gnutls/init.h
index ea5fc261..6de52983 100644
--- a/src/gnutls/init.h
+++ b/src/gnutls/init.h
@@ -39,6 +39,7 @@
39 */ 39 */
40void 40void
41MHD_TLS_check_global_init_ (void); 41MHD_TLS_check_global_init_ (void);
42
42#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ 43#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
43 44
44 45
diff --git a/src/include/mhd_options.h b/src/include/mhd_options.h
index 26ab49e1..354ccb45 100644
--- a/src/include/mhd_options.h
+++ b/src/include/mhd_options.h
@@ -42,7 +42,6 @@
42#define _(String) (String) 42#define _(String) (String)
43 43
44 44
45
46#ifndef _MHD_EXTERN 45#ifndef _MHD_EXTERN
47#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \ 46#if defined(BUILDING_MHD_LIB) && defined(_WIN32) && \
48 (defined(DLL_EXPORT) || defined(MHD_W32DLL)) 47 (defined(DLL_EXPORT) || defined(MHD_W32DLL))
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index d90484b8..61d6ec23 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -2670,8 +2670,6 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
2670 const fd_set *except_fd_set); 2670 const fd_set *except_fd_set);
2671 2671
2672 2672
2673
2674
2675/* **************** Connection handling functions ***************** */ 2673/* **************** Connection handling functions ***************** */
2676 2674
2677/** 2675/**
@@ -3085,8 +3083,6 @@ MHD_create_response_from_buffer (size_t size,
3085 enum MHD_ResponseMemoryMode mode); 3083 enum MHD_ResponseMemoryMode mode);
3086 3084
3087 3085
3088
3089
3090/** 3086/**
3091 * Create a response object. The response object can be extended with 3087 * Create a response object. The response object can be extended with
3092 * header information and then be used any number of times. 3088 * header information and then be used any number of times.
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index 9716573c..1262c7a8 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -124,7 +124,6 @@ typedef intptr_t ssize_t;
124#define MHD_VERSION 0x01000000 124#define MHD_VERSION 0x01000000
125 125
126 126
127
128/** 127/**
129 * Representation of 'bool' in the public API as stdbool.h may not 128 * Representation of 'bool' in the public API as stdbool.h may not
130 * always be available. 129 * always be available.
@@ -526,7 +525,6 @@ enum MHD_StatusCode
526 MHD_SC_CHUNKED_ENCODING_MALFORMED = 40007, 525 MHD_SC_CHUNKED_ENCODING_MALFORMED = 40007,
527 526
528 527
529
530 /* 50000-level errors are because of an error internal 528 /* 50000-level errors are because of an error internal
531 to the MHD logic, possibly including our interaction 529 to the MHD logic, possibly including our interaction
532 with the operating system (but not the application) */ 530 with the operating system (but not the application) */
@@ -826,7 +824,6 @@ enum MHD_StatusCode
826 MHD_SC_FAILED_RESPONSE_HEADER_GENERATION = 50056, 824 MHD_SC_FAILED_RESPONSE_HEADER_GENERATION = 50056,
827 825
828 826
829
830 /* 60000-level errors are because the application 827 /* 60000-level errors are because the application
831 logic did something wrong or generated an error. */ 828 logic did something wrong or generated an error. */
832 829
@@ -1137,7 +1134,6 @@ enum MHD_Method
1137/** @} */ /* end of group postenc */ 1134/** @} */ /* end of group postenc */
1138 1135
1139 1136
1140
1141/** 1137/**
1142 * @defgroup headers HTTP headers 1138 * @defgroup headers HTTP headers
1143 * These are the standard headers found in HTTP requests and responses. 1139 * These are the standard headers found in HTTP requests and responses.
@@ -2656,7 +2652,6 @@ enum MHD_ValueKind
2656}; 2652};
2657 2653
2658 2654
2659
2660/** 2655/**
2661 * Iterator over key-value pairs. This iterator can be used to 2656 * Iterator over key-value pairs. This iterator can be used to
2662 * iterate over all of the cookies, headers, or POST-data fields of a 2657 * iterate over all of the cookies, headers, or POST-data fields of a
@@ -2747,7 +2742,6 @@ MHD_request_lookup_value (struct MHD_Request *request,
2747MHD_NONNULL (1); 2742MHD_NONNULL (1);
2748 2743
2749 2744
2750
2751/** 2745/**
2752 * @defgroup httpcode HTTP response codes. 2746 * @defgroup httpcode HTTP response codes.
2753 * These are the status codes defined for HTTP responses. 2747 * These are the status codes defined for HTTP responses.
@@ -3587,7 +3581,6 @@ MHD_action_parse_post (size_t buffer_size,
3587MHD_NONNULL (2); 3581MHD_NONNULL (2);
3588 3582
3589 3583
3590
3591/* ********************** generic query functions ********************** */ 3584/* ********************** generic query functions ********************** */
3592 3585
3593 3586
diff --git a/src/include/microhttpd_tls.h b/src/include/microhttpd_tls.h
index 7bd7d477..2834f333 100644
--- a/src/include/microhttpd_tls.h
+++ b/src/include/microhttpd_tls.h
@@ -46,7 +46,6 @@
46struct MHD_TLS_ConnectionState; 46struct MHD_TLS_ConnectionState;
47 47
48 48
49
50/** 49/**
51 * Callback functions to use for TLS operations. 50 * Callback functions to use for TLS operations.
52 */ 51 */
diff --git a/src/lib/action_continue.c b/src/lib/action_continue.c
index 9d98940b..2063f354 100644
--- a/src/lib/action_continue.c
+++ b/src/lib/action_continue.c
@@ -61,4 +61,5 @@ MHD_action_continue (void)
61 return &acont; 61 return &acont;
62} 62}
63 63
64
64/* end of action_continue.c */ 65/* end of action_continue.c */
diff --git a/src/lib/action_from_response.c b/src/lib/action_from_response.c
index 6253fb22..f12dcb90 100644
--- a/src/lib/action_from_response.c
+++ b/src/lib/action_from_response.c
@@ -48,7 +48,7 @@ response_action (void *cls,
48 48
49#ifdef UPGRADE_SUPPORT 49#ifdef UPGRADE_SUPPORT
50 if ( (NULL != response->upgrade_handler) && 50 if ( (NULL != response->upgrade_handler) &&
51 daemon->disallow_upgrade ) 51 daemon->disallow_upgrade)
52 { 52 {
53#ifdef HAVE_MESSAGES 53#ifdef HAVE_MESSAGES
54 MHD_DLOG (daemon, 54 MHD_DLOG (daemon,
@@ -128,4 +128,5 @@ MHD_action_from_response (struct MHD_Response *response,
128 return &response->action; 128 return &response->action;
129} 129}
130 130
131
131/* end of action_from_response */ 132/* end of action_from_response */
diff --git a/src/lib/action_parse_post.c b/src/lib/action_parse_post.c
index 53757933..187caaca 100644
--- a/src/lib/action_parse_post.c
+++ b/src/lib/action_parse_post.c
@@ -25,7 +25,6 @@
25#include "internal.h" 25#include "internal.h"
26 26
27 27
28
29/** 28/**
30 * Create an action that parses a POST request. 29 * Create an action that parses a POST request.
31 * 30 *
@@ -58,4 +57,5 @@ MHD_action_parse_post (size_t buffer_size,
58 return NULL; /* not yet implemented */ 57 return NULL; /* not yet implemented */
59} 58}
60 59
60
61/* end of action_parse_post.c */ 61/* end of action_parse_post.c */
diff --git a/src/lib/action_suspend.c b/src/lib/action_suspend.c
index c176e494..370a1f6a 100644
--- a/src/lib/action_suspend.c
+++ b/src/lib/action_suspend.c
@@ -134,4 +134,5 @@ MHD_action_suspend (void)
134 return &suspend; 134 return &suspend;
135} 135}
136 136
137
137/* end of action_suspend.c */ 138/* end of action_suspend.c */
diff --git a/src/lib/connection_add.c b/src/lib/connection_add.c
index aaf04712..be75946d 100644
--- a/src/lib/connection_add.c
+++ b/src/lib/connection_add.c
@@ -69,6 +69,8 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
69 /* Do not set 'urh->clean_ready' yet as 'urh' will be used 69 /* Do not set 'urh->clean_ready' yet as 'urh' will be used
70 * in connection thread for a little while. */ 70 * in connection thread for a little while. */
71} 71}
72
73
72#endif /* UPGRADE_SUPPORT */ 74#endif /* UPGRADE_SUPPORT */
73 75
74 76
@@ -1054,7 +1056,7 @@ MHD_accept_connection_ (struct MHD_Daemon *daemon)
1054 { 1056 {
1055 MHD_socket_close_chk_ (s); 1057 MHD_socket_close_chk_ (s);
1056 } 1058 }
1057 if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) ) 1059 if (MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
1058 { 1060 {
1059 /* system/process out of resources */ 1061 /* system/process out of resources */
1060 if (0 == daemon->connections) 1062 if (0 == daemon->connections)
@@ -1134,4 +1136,5 @@ MHD_accept_connection_ (struct MHD_Daemon *daemon)
1134 sk_nonbl); 1136 sk_nonbl);
1135} 1137}
1136 1138
1139
1137/* end of connection_add.c */ 1140/* end of connection_add.c */
diff --git a/src/lib/connection_call_handlers.c b/src/lib/connection_call_handlers.c
index c4fb448e..148e6345 100644
--- a/src/lib/connection_call_handlers.c
+++ b/src/lib/connection_call_handlers.c
@@ -146,9 +146,10 @@ MHD_conn_init_static_ (void)
146 } 146 }
147#endif /* SF_FLAGS */ 147#endif /* SF_FLAGS */
148} 148}
149#endif /* HAVE_FREEBSD_SENDFILE */
150 149
151 150
151#endif /* HAVE_FREEBSD_SENDFILE */
152
152 153
153/** 154/**
154 * Message to transmit when http 1.1 request is received 155 * Message to transmit when http 1.1 request is received
@@ -439,8 +440,7 @@ sendfile_adapter (struct MHD_Connection *connection)
439 supported for FD or other 'unusual' errors occurred, so we should try 440 supported for FD or other 'unusual' errors occurred, so we should try
440 to fall back to 'SEND'; see also this thread for info on 441 to fall back to 'SEND'; see also this thread for info on
441 odd libc/Linux behavior with sendfile: 442 odd libc/Linux behavior with sendfile:
442 http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ 443 http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */request->resp_sender = MHD_resp_sender_std;
443 request->resp_sender = MHD_resp_sender_std;
444 return MHD_ERR_AGAIN_; 444 return MHD_ERR_AGAIN_;
445#else /* HAVE_SOLARIS_SENDFILE */ 445#else /* HAVE_SOLARIS_SENDFILE */
446 if ( (EAFNOSUPPORT == err) || 446 if ( (EAFNOSUPPORT == err) ||
@@ -534,6 +534,8 @@ sendfile_adapter (struct MHD_Connection *connection)
534#endif /* HAVE_FREEBSD_SENDFILE */ 534#endif /* HAVE_FREEBSD_SENDFILE */
535 return ret; 535 return ret;
536} 536}
537
538
537#endif /* _MHD_HAVE_SENDFILE */ 539#endif /* _MHD_HAVE_SENDFILE */
538 540
539 541
@@ -694,7 +696,7 @@ try_ready_chunked_body (struct MHD_Request *request)
694 = (size_t) (request->response_write_position - response->data_start); 696 = (size_t) (request->response_write_position - response->data_start);
695 /* buffer already ready, use what is there for the chunk */ 697 /* buffer already ready, use what is there for the chunk */
696 ret = response->data_size - data_write_offset; 698 ret = response->data_size - data_write_offset;
697 if ( ((size_t) ret) > request->write_buffer_size - sizeof (cbuf) - 2 ) 699 if ( ((size_t) ret) > request->write_buffer_size - sizeof (cbuf) - 2)
698 ret = request->write_buffer_size - sizeof (cbuf) - 2; 700 ret = request->write_buffer_size - sizeof (cbuf) - 2;
699 memcpy (&request->write_buffer[sizeof (cbuf)], 701 memcpy (&request->write_buffer[sizeof (cbuf)],
700 &response->data[data_write_offset], 702 &response->data[data_write_offset],
@@ -1434,8 +1436,7 @@ build_header_response (struct MHD_Request *request)
1434 1436
1435 Note that the change from 'SHOULD NOT' to 'MUST NOT' is 1437 Note that the change from 'SHOULD NOT' to 'MUST NOT' is
1436 a recent development of the HTTP 1.1 specification. 1438 a recent development of the HTTP 1.1 specification.
1437 */ 1439 */content_length_len
1438 content_length_len
1439 = MHD_snprintf_ (content_length_buf, 1440 = MHD_snprintf_ (content_length_buf,
1440 sizeof (content_length_buf), 1441 sizeof (content_length_buf),
1441 MHD_HTTP_HEADER_CONTENT_LENGTH ": " 1442 MHD_HTTP_HEADER_CONTENT_LENGTH ": "
@@ -1926,8 +1927,7 @@ process_header_line (struct MHD_Request *request,
1926 header at the beginning of the while 1927 header at the beginning of the while
1927 loop since we need to be able to inspect 1928 loop since we need to be able to inspect
1928 the *next* header line (in case it starts 1929 the *next* header line (in case it starts
1929 with a space...) */ 1930 with a space...) */request->last = line;
1930 request->last = line;
1931 request->colon = colon; 1931 request->colon = colon;
1932 return true; 1932 return true;
1933} 1933}
@@ -1975,8 +1975,7 @@ process_broken_line (struct MHD_Request *request,
1975 adjacency); also, in the case where these are not adjacent 1975 adjacency); also, in the case where these are not adjacent
1976 (not sure how it can happen!), we would want to allocate from 1976 (not sure how it can happen!), we would want to allocate from
1977 the end of the pool, so as to not destroy the read-buffer's 1977 the end of the pool, so as to not destroy the read-buffer's
1978 ability to grow nicely. */ 1978 ability to grow nicely. */last = MHD_pool_reallocate (connection->pool,
1979 last = MHD_pool_reallocate (connection->pool,
1980 last, 1979 last,
1981 last_len + 1, 1980 last_len + 1,
1982 last_len + tmp_len + 1); 1981 last_len + tmp_len + 1);
@@ -2926,6 +2925,8 @@ connection_epoll_update_ (struct MHD_Connection *connection)
2926 } 2925 }
2927 return true; 2926 return true;
2928} 2927}
2928
2929
2929#endif 2930#endif
2930 2931
2931 2932
@@ -3014,8 +3015,7 @@ connection_update_event_loop_info (struct MHD_Connection *connection)
3014 or if we do nothing, we would just timeout 3015 or if we do nothing, we would just timeout
3015 on the connection (if a timeout is even set!). 3016 on the connection (if a timeout is even set!).
3016 3017
3017 Solution: we kill the connection with an error */ 3018 Solution: we kill the connection with an error */transmit_error_response (request,
3018 transmit_error_response (request,
3019 MHD_SC_APPLICATION_HUNG_CONNECTION_CLOSED, 3019 MHD_SC_APPLICATION_HUNG_CONNECTION_CLOSED,
3020 MHD_HTTP_INTERNAL_SERVER_ERROR, 3020 MHD_HTTP_INTERNAL_SERVER_ERROR,
3021 INTERNAL_ERROR); 3021 INTERNAL_ERROR);
@@ -3675,10 +3675,8 @@ MHD_connection_call_handlers_ (struct MHD_Connection *con,
3675 immediately. 3675 immediately.
3676 As writeability of socket was not checked and it may have 3676 As writeability of socket was not checked and it may have
3677 some data pending in system buffers, use this optimization 3677 some data pending in system buffers, use this optimization
3678 only for non-blocking sockets. */ 3678 only for non-blocking sockets. *//* No need to check 'ret' as connection is always in
3679 /* No need to check 'ret' as connection is always in 3679 * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */else if (on_fasttrack &&
3680 * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */
3681 else if (on_fasttrack &&
3682 con->sk_nonblck) 3680 con->sk_nonblck)
3683 { 3681 {
3684 if (MHD_REQUEST_HEADERS_SENDING == con->request.state) 3682 if (MHD_REQUEST_HEADERS_SENDING == con->request.state)
@@ -3722,4 +3720,5 @@ MHD_connection_call_handlers_ (struct MHD_Connection *con,
3722 return ret; 3720 return ret;
3723} 3721}
3724 3722
3723
3725/* end of connection_call_handlers.c */ 3724/* end of connection_call_handlers.c */
diff --git a/src/lib/connection_cleanup.c b/src/lib/connection_cleanup.c
index 4f2cfb0f..d03bc046 100644
--- a/src/lib/connection_cleanup.c
+++ b/src/lib/connection_cleanup.c
@@ -59,6 +59,8 @@ connection_cleanup_upgraded (struct MHD_Connection *connection)
59 connection->request.urh = NULL; 59 connection->request.urh = NULL;
60 free (urh); 60 free (urh);
61} 61}
62
63
62#endif /* UPGRADE_SUPPORT */ 64#endif /* UPGRADE_SUPPORT */
63 65
64 66
@@ -129,8 +131,7 @@ MHD_connection_cleanup_ (struct MHD_Daemon *daemon)
129 this is not true as if we fail to do manually remove it, 131 this is not true as if we fail to do manually remove it,
130 we are still seeing an event for this fd in epoll, 132 we are still seeing an event for this fd in epoll,
131 causing grief (use-after-free...) --- at least on my 133 causing grief (use-after-free...) --- at least on my
132 system. */ 134 system. */if (0 != epoll_ctl (daemon->epoll_fd,
133 if (0 != epoll_ctl (daemon->epoll_fd,
134 EPOLL_CTL_DEL, 135 EPOLL_CTL_DEL,
135 pos->socket_fd, 136 pos->socket_fd,
136 NULL)) 137 NULL))
@@ -155,4 +156,5 @@ MHD_connection_cleanup_ (struct MHD_Daemon *daemon)
155 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 156 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
156} 157}
157 158
159
158/* end of connection_cleanup.c */ 160/* end of connection_cleanup.c */
diff --git a/src/lib/connection_close.c b/src/lib/connection_close.c
index 3c872b0b..1effe4b5 100644
--- a/src/lib/connection_close.c
+++ b/src/lib/connection_close.c
@@ -48,8 +48,7 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
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.
50 * Closure of TLS layer will be interpreted by 50 * Closure of TLS layer will be interpreted by
51 * remote side as end of transmission. */ 51 * remote side as end of transmission. */if (NULL != (tls = daemon->tls_api))
52 if (NULL != (tls = daemon->tls_api))
53 { 52 {
54 if (MHD_YES != 53 if (MHD_YES !=
55 tls->shutdown_connection (tls->cls, 54 tls->shutdown_connection (tls->cls,
@@ -100,4 +99,5 @@ MHD_connection_close_ (struct MHD_Connection *connection,
100 MHD_CONNECTION_NOTIFY_CLOSED); 99 MHD_CONNECTION_NOTIFY_CLOSED);
101} 100}
102 101
102
103/* end of connection_close.c */ 103/* end of connection_close.c */
diff --git a/src/lib/connection_finish_forward.c b/src/lib/connection_finish_forward.c
index 1ea9aa31..1a4bdfeb 100644
--- a/src/lib/connection_finish_forward.c
+++ b/src/lib/connection_finish_forward.c
@@ -87,8 +87,9 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
87 * used with MHD_UPGRADE_ACTION_CLOSE. They will be 87 * used with MHD_UPGRADE_ACTION_CLOSE. They will be
88 * closed by MHD_cleanup_upgraded_connection_() during 88 * closed by MHD_cleanup_upgraded_connection_() during
89 * connection's final cleanup. 89 * connection's final cleanup.
90 */ 90 */}
91} 91
92
92#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/ 93#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/
93 94
94/* end of connection_finish_forward.c */ 95/* end of connection_finish_forward.c */
diff --git a/src/lib/connection_info.c b/src/lib/connection_info.c
index d83b34c5..45f14063 100644
--- a/src/lib/connection_info.c
+++ b/src/lib/connection_info.c
@@ -107,4 +107,5 @@ MHD_connection_get_information_sz (struct MHD_Connection *connection,
107#undef CHECK_SIZE 107#undef CHECK_SIZE
108} 108}
109 109
110
110/* end of connection_info.c */ 111/* end of connection_info.c */
diff --git a/src/lib/connection_options.c b/src/lib/connection_options.c
index ce31b315..ef167354 100644
--- a/src/lib/connection_options.c
+++ b/src/lib/connection_options.c
@@ -114,4 +114,5 @@ MHD_update_last_activity_ (struct MHD_Connection *connection)
114 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 114 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
115} 115}
116 116
117
117/* end of connection_options.c */ 118/* end of connection_options.c */
diff --git a/src/lib/connection_update_last_activity.c b/src/lib/connection_update_last_activity.c
index 741da681..73628675 100644
--- a/src/lib/connection_update_last_activity.c
+++ b/src/lib/connection_update_last_activity.c
@@ -61,4 +61,5 @@ MHD_connection_update_last_activity_ (struct MHD_Connection *connection)
61 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); 61 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
62} 62}
63 63
64
64/* end of connection_update_last_activity.c */ 65/* end of connection_update_last_activity.c */
diff --git a/src/lib/daemon_close_all_connections.c b/src/lib/daemon_close_all_connections.c
index 1a777494..20ae743e 100644
--- a/src/lib/daemon_close_all_connections.c
+++ b/src/lib/daemon_close_all_connections.c
@@ -233,4 +233,5 @@ MHD_daemon_close_all_connections_ (struct MHD_Daemon *daemon)
233 MHD_connection_cleanup_ (daemon); 233 MHD_connection_cleanup_ (daemon);
234} 234}
235 235
236
236/* end of daemon_close_all_connections.c */ 237/* end of daemon_close_all_connections.c */
diff --git a/src/lib/daemon_destroy.c b/src/lib/daemon_destroy.c
index a76c2d6b..41e5c057 100644
--- a/src/lib/daemon_destroy.c
+++ b/src/lib/daemon_destroy.c
@@ -199,4 +199,5 @@ MHD_daemon_destroy (struct MHD_Daemon *daemon)
199 free (daemon); 199 free (daemon);
200} 200}
201 201
202
202/* end of daemon_destroy.c */ 203/* end of daemon_destroy.c */
diff --git a/src/lib/daemon_epoll.c b/src/lib/daemon_epoll.c
index b25ba9a7..ff3e846c 100644
--- a/src/lib/daemon_epoll.c
+++ b/src/lib/daemon_epoll.c
@@ -199,6 +199,8 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
199 199
200 return MHD_SC_OK; 200 return MHD_SC_OK;
201} 201}
202
203
202#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 204#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
203 205
204 206
@@ -488,8 +490,7 @@ MHD_daemon_epoll_ (struct MHD_Daemon *daemon,
488 here. 490 here.
489 491
490 Connections with custom timeouts must all be looked at, as we 492 Connections with custom timeouts must all be looked at, as we
491 do not bother to sort that (presumably very short) list. */ 493 do not bother to sort that (presumably very short) list. */prev = daemon->manual_timeout_tail;
492 prev = daemon->manual_timeout_tail;
493 while (NULL != (pos = prev)) 494 while (NULL != (pos = prev))
494 { 495 {
495 prev = pos->prevX; 496 prev = pos->prevX;
@@ -509,6 +510,8 @@ MHD_daemon_epoll_ (struct MHD_Daemon *daemon,
509 } 510 }
510 return MHD_SC_OK; 511 return MHD_SC_OK;
511} 512}
513
514
512#endif 515#endif
513 516
514/* end of daemon_epoll.c */ 517/* end of daemon_epoll.c */
diff --git a/src/lib/daemon_get_timeout.c b/src/lib/daemon_get_timeout.c
index 604c52e2..8e343008 100644
--- a/src/lib/daemon_get_timeout.c
+++ b/src/lib/daemon_get_timeout.c
@@ -123,4 +123,5 @@ MHD_daemon_get_timeout (struct MHD_Daemon *daemon,
123 return MHD_SC_OK; 123 return MHD_SC_OK;
124} 124}
125 125
126
126/* end of daemon_get_timeout.c */ 127/* end of daemon_get_timeout.c */
diff --git a/src/lib/daemon_info.c b/src/lib/daemon_info.c
index d32f244b..fe5e8d25 100644
--- a/src/lib/daemon_info.c
+++ b/src/lib/daemon_info.c
@@ -102,4 +102,5 @@ MHD_daemon_get_information_sz (struct MHD_Daemon *daemon,
102#undef CHECK_SIZE 102#undef CHECK_SIZE
103} 103}
104 104
105
105/* end of daemon_info.c */ 106/* end of daemon_info.c */
diff --git a/src/lib/daemon_ip_limit.c b/src/lib/daemon_ip_limit.c
index 21550265..4b33e029 100644
--- a/src/lib/daemon_ip_limit.c
+++ b/src/lib/daemon_ip_limit.c
@@ -299,4 +299,5 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
299 MHD_ip_count_unlock (daemon); 299 MHD_ip_count_unlock (daemon);
300} 300}
301 301
302
302/* end of daemon_ip_limit.c */ 303/* end of daemon_ip_limit.c */
diff --git a/src/lib/daemon_poll.c b/src/lib/daemon_poll.c
index 1fea9fd6..ec52b45d 100644
--- a/src/lib/daemon_poll.c
+++ b/src/lib/daemon_poll.c
@@ -125,6 +125,8 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
125 if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR)) 125 if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR))
126 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; 126 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY;
127} 127}
128
129
128#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 130#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
129 131
130 132
@@ -429,6 +431,8 @@ MHD_daemon_poll_listen_socket_ (struct MHD_Daemon *daemon,
429 (void) MHD_accept_connection_ (daemon); 431 (void) MHD_accept_connection_ (daemon);
430 return MHD_SC_OK; 432 return MHD_SC_OK;
431} 433}
434
435
432#endif 436#endif
433 437
434 438
@@ -516,6 +520,8 @@ MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con)
516 MHD_upgrade_response_handle_process_ (urh); 520 MHD_upgrade_response_handle_process_ (urh);
517 } 521 }
518} 522}
523
524
519#endif 525#endif
520#endif 526#endif
521 527
diff --git a/src/lib/daemon_poll.h b/src/lib/daemon_poll.h
index 3c408620..8cf548d5 100644
--- a/src/lib/daemon_poll.h
+++ b/src/lib/daemon_poll.h
@@ -65,6 +65,7 @@ enum MHD_StatusCode
65MHD_daemon_poll_ (struct MHD_Daemon *daemon, 65MHD_daemon_poll_ (struct MHD_Daemon *daemon,
66 bool may_block) 66 bool may_block)
67MHD_NONNULL (1); 67MHD_NONNULL (1);
68
68#endif 69#endif
69 70
70 71
@@ -79,6 +80,7 @@ MHD_NONNULL (1);
79void 80void
80MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con) 81MHD_daemon_upgrade_connection_with_poll_ (struct MHD_Connection *con)
81MHD_NONNULL (1); 82MHD_NONNULL (1);
83
82#endif 84#endif
83#endif 85#endif
84 86
diff --git a/src/lib/daemon_quiesce.c b/src/lib/daemon_quiesce.c
index c7275099..6231bf39 100644
--- a/src/lib/daemon_quiesce.c
+++ b/src/lib/daemon_quiesce.c
@@ -121,9 +121,8 @@ MHD_daemon_quiesce (struct MHD_Daemon *daemon)
121 to be sure that the threads have stopped using the listen 121 to be sure that the threads have stopped using the listen
122 socket, otherwise there is still the possibility of a race 122 socket, otherwise there is still the possibility of a race
123 between a thread accept()ing and the caller closing and 123 between a thread accept()ing and the caller closing and
124 re-binding the socket. */ 124 re-binding the socket. */return listen_socket;
125
126 return listen_socket;
127} 125}
128 126
127
129/* end of daemon_quiesce.c */ 128/* end of daemon_quiesce.c */
diff --git a/src/lib/daemon_run.c b/src/lib/daemon_run.c
index cae500da..9c686881 100644
--- a/src/lib/daemon_run.c
+++ b/src/lib/daemon_run.c
@@ -79,4 +79,5 @@ MHD_daemon_run (struct MHD_Daemon *daemon)
79 } 79 }
80} 80}
81 81
82
82/* end of daemon_run.c */ 83/* end of daemon_run.c */
diff --git a/src/lib/daemon_select.c b/src/lib/daemon_select.c
index 69913a9a..be8c247c 100644
--- a/src/lib/daemon_select.c
+++ b/src/lib/daemon_select.c
@@ -160,6 +160,8 @@ urh_to_fdset (struct MHD_UpgradeResponseHandle *urh,
160 160
161 return res; 161 return res;
162} 162}
163
164
163#endif 165#endif
164 166
165 167
@@ -392,6 +394,8 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh,
392 urh->mhd.celi |= MHD_EPOLL_STATE_ERROR; 394 urh->mhd.celi |= MHD_EPOLL_STATE_ERROR;
393 } 395 }
394} 396}
397
398
395#endif 399#endif
396 400
397 401
@@ -575,6 +579,8 @@ MHD_daemon_upgrade_connection_with_select_ (struct MHD_Connection *con)
575 MHD_upgrade_response_handle_process_ (urh); 579 MHD_upgrade_response_handle_process_ (urh);
576 } 580 }
577} 581}
582
583
578#endif 584#endif
579 585
580 586
@@ -742,6 +748,8 @@ MHD_daemon_select_ (struct MHD_Daemon *daemon,
742#if defined(MHD_WINSOCK_SOCKETS) 748#if defined(MHD_WINSOCK_SOCKETS)
743 } 749 }
744} 750}
751
752
745#endif /* MHD_WINSOCK_SOCKETS */ 753#endif /* MHD_WINSOCK_SOCKETS */
746 } 754 }
747 /* Stop listening if we are at the configured connection limit */ 755 /* Stop listening if we are at the configured connection limit */
diff --git a/src/lib/daemon_select.h b/src/lib/daemon_select.h
index 7dac8a80..a82725fb 100644
--- a/src/lib/daemon_select.h
+++ b/src/lib/daemon_select.h
@@ -50,6 +50,7 @@ MHD_NONNULL (1);
50void 50void
51MHD_daemon_upgrade_connection_with_select_ (struct MHD_Connection *con) 51MHD_daemon_upgrade_connection_with_select_ (struct MHD_Connection *con)
52MHD_NONNULL (1); 52MHD_NONNULL (1);
53
53#endif 54#endif
54 55
55#endif 56#endif
diff --git a/src/lib/daemon_start.c b/src/lib/daemon_start.c
index c8c498be..0a1b052e 100644
--- a/src/lib/daemon_start.c
+++ b/src/lib/daemon_start.c
@@ -603,6 +603,8 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
603 } 603 }
604 return MHD_SC_OK; 604 return MHD_SC_OK;
605} 605}
606
607
606#endif 608#endif
607 609
608 610
diff --git a/src/lib/init.c b/src/lib/init.c
index 5dcb02c4..4b844d4b 100644
--- a/src/lib/init.c
+++ b/src/lib/init.c
@@ -121,6 +121,7 @@ MHD_fini (void)
121 MHD_monotonic_sec_counter_finish (); 121 MHD_monotonic_sec_counter_finish ();
122} 122}
123 123
124
124#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED 125#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
125 126
126_SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini); 127_SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini);
@@ -143,4 +144,6 @@ MHD_check_global_init_ (void)
143 MHD_mutex_unlock_chk_ (&global_init_mutex_); 144 MHD_mutex_unlock_chk_ (&global_init_mutex_);
144#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ 145#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
145} 146}
147
148
146#endif 149#endif
diff --git a/src/lib/init.h b/src/lib/init.h
index 2d9a9389..b5671b2c 100644
--- a/src/lib/init.h
+++ b/src/lib/init.h
@@ -39,6 +39,7 @@
39 */ 39 */
40void 40void
41MHD_check_global_init_ (void); 41MHD_check_global_init_ (void);
42
42#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ 43#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
43 44
44 45
diff --git a/src/lib/internal.c b/src/lib/internal.c
index 04d83624..ade15e0a 100644
--- a/src/lib/internal.c
+++ b/src/lib/internal.c
@@ -80,6 +80,8 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
80 return "unrecognized connection state"; 80 return "unrecognized connection state";
81 } 81 }
82} 82}
83
84
83#endif 85#endif
84#endif 86#endif
85 87
@@ -107,6 +109,8 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
107 va); 109 va);
108 va_end (va); 110 va_end (va);
109} 111}
112
113
110#endif 114#endif
111 115
112 116
@@ -280,4 +284,5 @@ MHD_parse_arguments_ (struct MHD_Request *request,
280 return true; 284 return true;
281} 285}
282 286
287
283/* end of internal.c */ 288/* end of internal.c */
diff --git a/src/lib/internal.h b/src/lib/internal.h
index b5ec3039..6c43fc20 100644
--- a/src/lib/internal.h
+++ b/src/lib/internal.h
@@ -87,6 +87,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
87 enum MHD_StatusCode sc, 87 enum MHD_StatusCode sc,
88 const char *format, 88 const char *format,
89 ...); 89 ...);
90
90#endif 91#endif
91 92
92 93
@@ -147,7 +148,6 @@ extern void *mhd_panic_cls;
147#endif /* ! MHD_STATICSTR_LEN_ */ 148#endif /* ! MHD_STATICSTR_LEN_ */
148 149
149 150
150
151/** 151/**
152 * Ability to use same connection for next request 152 * Ability to use same connection for next request
153 */ 153 */
@@ -1692,7 +1692,6 @@ struct MHD_Response
1692}; 1692};
1693 1693
1694 1694
1695
1696/** 1695/**
1697 * Callback invoked when iterating over @a key / @a value 1696 * Callback invoked when iterating over @a key / @a value
1698 * argument pairs during parsing. 1697 * argument pairs during parsing.
@@ -1733,7 +1732,6 @@ MHD_parse_arguments_ (struct MHD_Request *request,
1733 unsigned int *num_headers); 1732 unsigned int *num_headers);
1734 1733
1735 1734
1736
1737/** 1735/**
1738 * Insert an element at the head of a DLL. Assumes that head, tail and 1736 * Insert an element at the head of a DLL. Assumes that head, tail and
1739 * element are structs with prev and next fields. 1737 * element are structs with prev and next fields.
@@ -1777,7 +1775,6 @@ MHD_parse_arguments_ (struct MHD_Request *request,
1777 (element)->prev = NULL; } while (0) 1775 (element)->prev = NULL; } while (0)
1778 1776
1779 1777
1780
1781/** 1778/**
1782 * Insert an element at the head of a XDLL. Assumes that head, tail and 1779 * Insert an element at the head of a XDLL. Assumes that head, tail and
1783 * element are structs with prevX and nextX fields. 1780 * element are structs with prevX and nextX fields.
@@ -1860,7 +1857,6 @@ MHD_parse_arguments_ (struct MHD_Request *request,
1860 (element)->prevE = NULL; } while (0) 1857 (element)->prevE = NULL; } while (0)
1861 1858
1862 1859
1863
1864/** 1860/**
1865 * Error code similar to EGAIN or EINTR 1861 * Error code similar to EGAIN or EINTR
1866 */ 1862 */
@@ -1893,6 +1889,4 @@ MHD_parse_arguments_ (struct MHD_Request *request,
1893#define MHD_ERR_INVAL_ (-3078) 1889#define MHD_ERR_INVAL_ (-3078)
1894 1890
1895 1891
1896
1897
1898#endif 1892#endif
diff --git a/src/lib/md5.c b/src/lib/md5.c
index 3d0f7493..08f5c1d9 100644
--- a/src/lib/md5.c
+++ b/src/lib/md5.c
@@ -59,6 +59,7 @@ MHD_MD5Init (struct MD5Context *ctx)
59 ctx->state[3] = 0x10325476; 59 ctx->state[3] = 0x10325476;
60} 60}
61 61
62
62/* 63/*
63 * Update context to reflect the concatenation of another buffer full 64 * Update context to reflect the concatenation of another buffer full
64 * of bytes. 65 * of bytes.
@@ -103,6 +104,7 @@ MHD_MD5Update (struct MD5Context *ctx, const unsigned char *input, size_t len)
103 memcpy (ctx->buffer + have, input, len); 104 memcpy (ctx->buffer + have, input, len);
104} 105}
105 106
107
106/* 108/*
107 * Pad pad to 64-byte boundary with the bit pattern 109 * Pad pad to 64-byte boundary with the bit pattern
108 * 1 0* (64-bit count of bits processed, MSB-first) 110 * 1 0* (64-bit count of bits processed, MSB-first)
@@ -128,6 +130,7 @@ MD5Pad (struct MD5Context *ctx)
128 MHD_MD5Update (ctx, count, 8); 130 MHD_MD5Update (ctx, count, 8);
129} 131}
130 132
133
131/* 134/*
132 * Final wrapup--call MD5Pad, fill in digest and zero out ctx. 135 * Final wrapup--call MD5Pad, fill in digest and zero out ctx.
133 */ 136 */
@@ -261,4 +264,5 @@ MD5Transform (uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE])
261 state[3] += d; 264 state[3] += d;
262} 265}
263 266
267
264/* end of md5.c */ 268/* end of md5.c */
diff --git a/src/lib/mhd_byteorder.h b/src/lib/mhd_byteorder.h
index 230ae803..442e8e17 100644
--- a/src/lib/mhd_byteorder.h
+++ b/src/lib/mhd_byteorder.h
@@ -123,7 +123,7 @@
123 defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) 123 defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__)
124/* x86 family is little endian */ 124/* x86 family is little endian */
125#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN 125#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN
126#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ 126#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
127 defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) 127 defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
128/* Looks like we are on ARM/MIPS in big endian mode */ 128/* Looks like we are on ARM/MIPS in big endian mode */
129#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN 129#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN
diff --git a/src/lib/mhd_compat.c b/src/lib/mhd_compat.c
index 6f6c6f9c..fd8132ac 100644
--- a/src/lib/mhd_compat.c
+++ b/src/lib/mhd_compat.c
@@ -79,6 +79,7 @@ W32_snprintf (char *__restrict s,
79 return ret; 79 return ret;
80} 80}
81 81
82
82#endif /* HAVE_SNPRINTF */ 83#endif /* HAVE_SNPRINTF */
83#endif /* _WIN32 && !__CYGWIN__ */ 84#endif /* _WIN32 && !__CYGWIN__ */
84 85
@@ -93,16 +94,17 @@ W32_snprintf (char *__restrict s,
93#endif /* __GNUC__ >= 5 */ 94#endif /* __GNUC__ >= 5 */
94 95
95 96
96void *MHD_calloc_ (size_t nelem, size_t elsize) 97void *
98MHD_calloc_ (size_t nelem, size_t elsize)
97{ 99{
98 size_t alloc_size; 100 size_t alloc_size;
99 void *ptr; 101 void *ptr;
100#ifdef MHD_HAVE_NUL_OVERFLOW 102#ifdef MHD_HAVE_NUL_OVERFLOW
101 if (__builtin_mul_overflow (nelem, elsize, &alloc_size) ||(0 == alloc_size)) 103 if (__builtin_mul_overflow (nelem, elsize, &alloc_size) || (0 == alloc_size))
102 return NULL; 104 return NULL;
103#else /* ! MHD_HAVE_NUL_OVERFLOW */ 105#else /* ! MHD_HAVE_NUL_OVERFLOW */
104 alloc_size = nelem * elsize; 106 alloc_size = nelem * elsize;
105 if ((0 == alloc_size)||(elsize != alloc_size / nelem)) 107 if ((0 == alloc_size) || (elsize != alloc_size / nelem))
106 return NULL; 108 return NULL;
107#endif /* ! MHD_HAVE_NUL_OVERFLOW */ 109#endif /* ! MHD_HAVE_NUL_OVERFLOW */
108 ptr = malloc (alloc_size); 110 ptr = malloc (alloc_size);
@@ -111,4 +113,6 @@ void *MHD_calloc_ (size_t nelem, size_t elsize)
111 memset (ptr, 0, alloc_size); 113 memset (ptr, 0, alloc_size);
112 return ptr; 114 return ptr;
113} 115}
116
117
114#endif /* ! HAVE_CALLOC */ 118#endif /* ! HAVE_CALLOC */
diff --git a/src/lib/mhd_compat.h b/src/lib/mhd_compat.h
index 6b38a03e..4062c101 100644
--- a/src/lib/mhd_compat.h
+++ b/src/lib/mhd_compat.h
@@ -51,6 +51,7 @@
51/* Emulate snprintf function on W32 */ 51/* Emulate snprintf function on W32 */
52int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format, 52int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
53 ...); 53 ...);
54
54#define MHD_snprintf_ W32_snprintf 55#define MHD_snprintf_ W32_snprintf
55#else /* ! _WIN32 || __CYGWIN__ */ 56#else /* ! _WIN32 || __CYGWIN__ */
56#error \ 57#error \
@@ -84,6 +85,7 @@ int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
84 * MHD_calloc_ is platform-independent calloc() 85 * MHD_calloc_ is platform-independent calloc()
85 */ 86 */
86void *MHD_calloc_ (size_t nelem, size_t elsize); 87void *MHD_calloc_ (size_t nelem, size_t elsize);
88
87#endif /* ! HAVE_CALLOC */ 89#endif /* ! HAVE_CALLOC */
88 90
89#endif /* MHD_COMPAT_H */ 91#endif /* MHD_COMPAT_H */
diff --git a/src/lib/mhd_itc.c b/src/lib/mhd_itc.c
index 6c81ef62..ef5e49bd 100644
--- a/src/lib/mhd_itc.c
+++ b/src/lib/mhd_itc.c
@@ -65,6 +65,8 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc)
65 } 65 }
66 return ! 0; 66 return ! 0;
67} 67}
68
69
68#endif /* ! HAVE_PIPE2_FUNC */ 70#endif /* ! HAVE_PIPE2_FUNC */
69#endif /* !_WIN32 || __CYGWIN__ */ 71#endif /* !_WIN32 || __CYGWIN__ */
70#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */ 72#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */
diff --git a/src/lib/mhd_itc.h b/src/lib/mhd_itc.h
index 8e303ef9..a7cad0e1 100644
--- a/src/lib/mhd_itc.h
+++ b/src/lib/mhd_itc.h
@@ -242,6 +242,7 @@ static const uint64_t _MHD_itc_wr_data = 1;
242 */ 242 */
243int 243int
244MHD_itc_nonblocking_ (struct MHD_itc_ itc); 244MHD_itc_nonblocking_ (struct MHD_itc_ itc);
245
245#endif /* ! HAVE_PIPE2_FUNC */ 246#endif /* ! HAVE_PIPE2_FUNC */
246 247
247 248
diff --git a/src/lib/mhd_mono_clock.c b/src/lib/mhd_mono_clock.c
index eee911fb..fa548f6e 100644
--- a/src/lib/mhd_mono_clock.c
+++ b/src/lib/mhd_mono_clock.c
@@ -94,7 +94,6 @@ static int64_t perf_start;
94#endif /* _WIN32 */ 94#endif /* _WIN32 */
95 95
96 96
97
98/** 97/**
99 * Type of monotonic clock source 98 * Type of monotonic clock source
100 */ 99 */
diff --git a/src/lib/mhd_sockets.c b/src/lib/mhd_sockets.c
index 248b9a68..998bbfe9 100644
--- a/src/lib/mhd_sockets.c
+++ b/src/lib/mhd_sockets.c
@@ -37,7 +37,8 @@
37 * @param err the WinSock error code. 37 * @param err the WinSock error code.
38 * @return pointer to string description of specified WinSock error. 38 * @return pointer to string description of specified WinSock error.
39 */ 39 */
40const char*MHD_W32_strerror_winsock_ (int err) 40const char*
41MHD_W32_strerror_winsock_ (int err)
41{ 42{
42 switch (err) 43 switch (err)
43 { 44 {
@@ -358,6 +359,7 @@ MHD_W32_socket_pair_ (SOCKET sockets_pair[2], int non_blk)
358 return 0; 359 return 0;
359} 360}
360 361
362
361#endif /* MHD_WINSOCK_SOCKETS */ 363#endif /* MHD_WINSOCK_SOCKETS */
362 364
363 365
diff --git a/src/lib/mhd_sockets.h b/src/lib/mhd_sockets.h
index ebe40275..e0935418 100644
--- a/src/lib/mhd_sockets.h
+++ b/src/lib/mhd_sockets.h
@@ -534,6 +534,7 @@ typedef int MHD_SCKT_SEND_SIZE_;
534 * @return pointer to string description of specified WinSock error. 534 * @return pointer to string description of specified WinSock error.
535 */ 535 */
536const char*MHD_W32_strerror_winsock_ (int err); 536const char*MHD_W32_strerror_winsock_ (int err);
537
537#endif /* MHD_WINSOCK_SOCKETS */ 538#endif /* MHD_WINSOCK_SOCKETS */
538 539
539/* MHD_socket_last_strerr_ is description string of specified socket error code */ 540/* MHD_socket_last_strerr_ is description string of specified socket error code */
diff --git a/src/lib/mhd_str.c b/src/lib/mhd_str.c
index 6f2d7b98..d750a393 100644
--- a/src/lib/mhd_str.c
+++ b/src/lib/mhd_str.c
@@ -63,6 +63,8 @@ isasciilower (char c)
63{ 63{
64 return (c >= 'a') && (c <= 'z'); 64 return (c >= 'a') && (c <= 'z');
65} 65}
66
67
66#endif /* Disable unused functions. */ 68#endif /* Disable unused functions. */
67 69
68 70
@@ -91,6 +93,8 @@ isasciialpha (char c)
91{ 93{
92 return isasciilower (c) || isasciiupper (c); 94 return isasciilower (c) || isasciiupper (c);
93} 95}
96
97
94#endif /* Disable unused functions. */ 98#endif /* Disable unused functions. */
95 99
96 100
@@ -106,6 +110,7 @@ isasciidigit (char c)
106 return (c >= '0') && (c <= '9'); 110 return (c >= '0') && (c <= '9');
107} 111}
108 112
113
109#if 0 /* Disable unused functions. */ 114#if 0 /* Disable unused functions. */
110/** 115/**
111 * Check whether character is hexadecimal digit in US-ASCII 116 * Check whether character is hexadecimal digit in US-ASCII
@@ -133,6 +138,8 @@ isasciialnum (char c)
133{ 138{
134 return isasciialpha (c) || isasciidigit (c); 139 return isasciialpha (c) || isasciidigit (c);
135} 140}
141
142
136#endif /* Disable unused functions. */ 143#endif /* Disable unused functions. */
137 144
138 145
@@ -167,6 +174,8 @@ toasciiupper (char c)
167{ 174{
168 return isasciilower (c) ? (c - 'a' + 'A') : c; 175 return isasciilower (c) ? (c - 'a' + 'A') : c;
169} 176}
177
178
170#endif /* Disable unused functions. */ 179#endif /* Disable unused functions. */
171 180
172 181
@@ -185,6 +194,8 @@ todigitvalue (char c)
185 194
186 return -1; 195 return -1;
187} 196}
197
198
188#endif /* MHD_FAVOR_SMALL_CODE */ 199#endif /* MHD_FAVOR_SMALL_CODE */
189 200
190 201
@@ -206,6 +217,8 @@ toxdigitvalue (char c)
206 217
207 return -1; 218 return -1;
208} 219}
220
221
209#else /* !INLINE_FUNC */ 222#else /* !INLINE_FUNC */
210 223
211 224
@@ -345,6 +358,8 @@ MHD_str_equal_caseless_ (const char *str1,
345 } 358 }
346 return 0 == (*str2); 359 return 0 == (*str2);
347} 360}
361
362
348#endif /* ! MHD_FAVOR_SMALL_CODE */ 363#endif /* ! MHD_FAVOR_SMALL_CODE */
349 364
350 365
@@ -427,7 +442,7 @@ MHD_str_has_token_caseless_ (const char *str,
427 while (' ' == *str || '\t' == *str) 442 while (' ' == *str || '\t' == *str)
428 str++; 443 str++;
429 /* End of (sub)string? */ 444 /* End of (sub)string? */
430 if ((0 == *str) ||(',' == *str) ) 445 if ((0 == *str) || (',' == *str) )
431 return true; 446 return true;
432 /* Unmatched chars at end of substring. */ 447 /* Unmatched chars at end of substring. */
433 break; 448 break;
@@ -440,6 +455,7 @@ MHD_str_has_token_caseless_ (const char *str,
440 return false; 455 return false;
441} 456}
442 457
458
443#ifndef MHD_FAVOR_SMALL_CODE 459#ifndef MHD_FAVOR_SMALL_CODE
444/* Use individual function for each case */ 460/* Use individual function for each case */
445 461
@@ -554,8 +570,8 @@ MHD_strx_to_uint32_ (const char *str,
554 while (digit >= 0) 570 while (digit >= 0)
555 { 571 {
556 if ( (res < (UINT32_MAX / 16)) || 572 if ( (res < (UINT32_MAX / 16)) ||
557 ((res == (UINT32_MAX / 16)) &&( (uint32_t) digit <= (UINT32_MAX 573 ((res == (UINT32_MAX / 16)) && ( (uint32_t) digit <= (UINT32_MAX
558 % 16)) ) ) 574 % 16)) ) )
559 { 575 {
560 res *= 16; 576 res *= 16;
561 res += digit; 577 res += digit;
@@ -601,8 +617,8 @@ MHD_strx_to_uint32_n_ (const char *str,
601 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) 617 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
602 { 618 {
603 if ( (res > (UINT32_MAX / 16)) || 619 if ( (res > (UINT32_MAX / 16)) ||
604 ((res == (UINT32_MAX / 16)) &&( (uint32_t) digit > (UINT32_MAX 620 ((res == (UINT32_MAX / 16)) && ( (uint32_t) digit > (UINT32_MAX
605 % 16)) ) ) 621 % 16)) ) )
606 return 0; 622 return 0;
607 623
608 res *= 16; 624 res *= 16;
@@ -641,8 +657,8 @@ MHD_strx_to_uint64_ (const char *str,
641 while (digit >= 0) 657 while (digit >= 0)
642 { 658 {
643 if ( (res < (UINT64_MAX / 16)) || 659 if ( (res < (UINT64_MAX / 16)) ||
644 ((res == (UINT64_MAX / 16)) &&( (uint64_t) digit <= (UINT64_MAX 660 ((res == (UINT64_MAX / 16)) && ( (uint64_t) digit <= (UINT64_MAX
645 % 16)) ) ) 661 % 16)) ) )
646 { 662 {
647 res *= 16; 663 res *= 16;
648 res += digit; 664 res += digit;
@@ -688,8 +704,8 @@ MHD_strx_to_uint64_n_ (const char *str,
688 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) 704 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
689 { 705 {
690 if ( (res > (UINT64_MAX / 16)) || 706 if ( (res > (UINT64_MAX / 16)) ||
691 ((res == (UINT64_MAX / 16)) &&( (uint64_t) digit > (UINT64_MAX 707 ((res == (UINT64_MAX / 16)) && ( (uint64_t) digit > (UINT64_MAX
692 % 16)) ) ) 708 % 16)) ) )
693 return 0; 709 return 0;
694 710
695 res *= 16; 711 res *= 16;
@@ -702,6 +718,7 @@ MHD_strx_to_uint64_n_ (const char *str,
702 return i; 718 return i;
703} 719}
704 720
721
705#else /* MHD_FAVOR_SMALL_CODE */ 722#else /* MHD_FAVOR_SMALL_CODE */
706 723
707/** 724/**
@@ -738,8 +755,8 @@ MHD_str_to_uvalue_n_ (const char *str,
738 int (*const dfunc)(char) = (base == 16) ? 755 int (*const dfunc)(char) = (base == 16) ?
739 toxdigitvalue : todigitvalue; 756 toxdigitvalue : todigitvalue;
740 757
741 if ( ! str || ! out_val || 758 if (! str || ! out_val ||
742 ((base != 16)&&(base != 10)) ) 759 ((base != 16) && (base != 10)) )
743 return 0; 760 return 0;
744 761
745 res = 0; 762 res = 0;
@@ -747,7 +764,7 @@ MHD_str_to_uvalue_n_ (const char *str,
747 while (maxlen > i && 0 <= (digit = dfunc (str[i]))) 764 while (maxlen > i && 0 <= (digit = dfunc (str[i])))
748 { 765 {
749 if ( ((max_v_div_b) < res) || 766 if ( ((max_v_div_b) < res) ||
750 (( (max_v_div_b) == res) &&( (max_v_mod_b) < (uint64_t) digit) ) ) 767 (( (max_v_div_b) == res) && ( (max_v_mod_b) < (uint64_t) digit) ) )
751 return 0; 768 return 0;
752 769
753 res *= base; 770 res *= base;
@@ -766,4 +783,6 @@ MHD_str_to_uvalue_n_ (const char *str,
766 } 783 }
767 return i; 784 return i;
768} 785}
786
787
769#endif /* MHD_FAVOR_SMALL_CODE */ 788#endif /* MHD_FAVOR_SMALL_CODE */
diff --git a/src/lib/mhd_str.h b/src/lib/mhd_str.h
index f0f6511d..b6355c3b 100644
--- a/src/lib/mhd_str.h
+++ b/src/lib/mhd_str.h
@@ -60,6 +60,7 @@
60int 60int
61MHD_str_equal_caseless_ (const char *str1, 61MHD_str_equal_caseless_ (const char *str1,
62 const char *str2); 62 const char *str2);
63
63#else /* MHD_FAVOR_SMALL_CODE */ 64#else /* MHD_FAVOR_SMALL_CODE */
64/* Reuse MHD_str_equal_caseless_n_() to reduce size */ 65/* Reuse MHD_str_equal_caseless_n_() to reduce size */
65#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \ 66#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \
diff --git a/src/lib/mhd_threads.c b/src/lib/mhd_threads.c
index a90090f4..980a2cbf 100644
--- a/src/lib/mhd_threads.c
+++ b/src/lib/mhd_threads.c
@@ -80,8 +80,7 @@ MHD_set_thread_name_ (const MHD_thread_ID_ thread_id,
80 * third argument is single argument for printf; 80 * third argument is single argument for printf;
81 * OSF1 use 3 arguments too, but last one always must be zero (NULL). 81 * OSF1 use 3 arguments too, but last one always must be zero (NULL).
82 * MHD doesn't use '%' in thread names, so both form are used in same way. 82 * MHD doesn't use '%' in thread names, so both form are used in same way.
83 */ 83 */return ! pthread_setname_np (thread_id, thread_name, 0);
84 return ! pthread_setname_np (thread_id, thread_name, 0);
85#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */ 84#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */
86} 85}
87 86
@@ -235,6 +234,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
235#endif 234#endif
236} 235}
237 236
237
238#ifdef MHD_USE_THREAD_NAME_ 238#ifdef MHD_USE_THREAD_NAME_
239 239
240#ifndef MHD_USE_THREAD_ATTR_SETNAME 240#ifndef MHD_USE_THREAD_ATTR_SETNAME
@@ -276,6 +276,8 @@ named_thread_starter (void *data)
276 276
277 return thr_func (arg); 277 return thr_func (arg);
278} 278}
279
280
279#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ 281#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
280 282
281 283
@@ -308,14 +310,13 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
308 * third argument is single argument for printf; 310 * third argument is single argument for printf;
309 * OSF1 use 3 arguments too, but last one always must be zero (NULL). 311 * OSF1 use 3 arguments too, but last one always must be zero (NULL).
310 * MHD doesn't use '%' in thread names, so both form are used in same way. 312 * MHD doesn't use '%' in thread names, so both form are used in same way.
311 */ 313 */res = pthread_attr_setname_np (&attr, thread_name, 0);
312 res = pthread_attr_setname_np (&attr, thread_name, 0);
313#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) 314#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI)
314 res = pthread_attr_setname_np (&attr, thread_name); 315 res = pthread_attr_setname_np (&attr, thread_name);
315#else 316#else
316#error No pthread_attr_setname_np() function. 317#error No pthread_attr_setname_np() function.
317#endif 318#endif
318 if ((res == 0) &&(0 != stack_size) ) 319 if ((res == 0) && (0 != stack_size) )
319 res = pthread_attr_setstacksize (&attr, 320 res = pthread_attr_setstacksize (&attr,
320 stack_size); 321 stack_size);
321 if (0 == res) 322 if (0 == res)
@@ -362,4 +363,5 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
362#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ 363#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
363} 364}
364 365
366
365#endif /* MHD_USE_THREAD_NAME_ */ 367#endif /* MHD_USE_THREAD_NAME_ */
diff --git a/src/lib/response.c b/src/lib/response.c
index 47dd98d6..aea187af 100644
--- a/src/lib/response.c
+++ b/src/lib/response.c
@@ -256,4 +256,5 @@ MHD_response_get_header (struct MHD_Response *response,
256 return NULL; 256 return NULL;
257} 257}
258 258
259
259/* end of response.c */ 260/* end of response.c */
diff --git a/src/lib/response_for_upgrade.c b/src/lib/response_for_upgrade.c
index ef66b029..26431e5b 100644
--- a/src/lib/response_for_upgrade.c
+++ b/src/lib/response_for_upgrade.c
@@ -91,4 +91,5 @@ MHD_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
91#endif 91#endif
92} 92}
93 93
94
94/* end of response_for_upgrade.c */ 95/* end of response_for_upgrade.c */
diff --git a/src/lib/response_from_buffer.c b/src/lib/response_from_buffer.c
index a65a0298..c964277d 100644
--- a/src/lib/response_from_buffer.c
+++ b/src/lib/response_from_buffer.c
@@ -85,4 +85,5 @@ MHD_response_from_buffer (enum MHD_HTTP_StatusCode sc,
85 return response; 85 return response;
86} 86}
87 87
88
88/* end of response_from_buffer.c */ 89/* end of response_from_buffer.c */
diff --git a/src/lib/response_from_fd.c b/src/lib/response_from_fd.c
index ffeb2b91..f44a83fb 100644
--- a/src/lib/response_from_fd.c
+++ b/src/lib/response_from_fd.c
@@ -207,4 +207,5 @@ MHD_response_from_fd (enum MHD_HTTP_StatusCode sc,
207 return response; 207 return response;
208} 208}
209 209
210
210/* end of response_from_fd.c */ 211/* end of response_from_fd.c */
diff --git a/src/lib/tsearch.c b/src/lib/tsearch.c
index e43d758f..78f37608 100644
--- a/src/lib/tsearch.c
+++ b/src/lib/tsearch.c
@@ -102,7 +102,7 @@ tdelete (const void *__restrict vkey,
102 node_t *r; 102 node_t *r;
103 int cmp; 103 int cmp;
104 104
105 if ((rootp == NULL)||((p = *rootp) == NULL)) 105 if ((rootp == NULL) || ((p = *rootp) == NULL))
106 return NULL; 106 return NULL;
107 107
108 while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) 108 while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0)
@@ -140,4 +140,5 @@ tdelete (const void *__restrict vkey,
140 return p; 140 return p;
141} 141}
142 142
143
143/* end of tsearch.c */ 144/* end of tsearch.c */
diff --git a/src/lib/upgrade_process.c b/src/lib/upgrade_process.c
index 353f2753..6b0ccf45 100644
--- a/src/lib/upgrade_process.c
+++ b/src/lib/upgrade_process.c
@@ -85,8 +85,7 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
85 * check for any pending data even if socket is not marked 85 * check for any pending data even if socket is not marked
86 * as 'ready' (signal may arrive after poll()/select()). 86 * as 'ready' (signal may arrive after poll()/select()).
87 * Socketpair for forwarding is always in non-blocking mode 87 * Socketpair for forwarding is always in non-blocking mode
88 * so no risk that recv() will block the thread. */ 88 * so no risk that recv() will block the thread. */if (0 != urh->out_buffer_size)
89 if (0 != urh->out_buffer_size)
90 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; 89 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
91 /* Discard any data received form remote. */ 90 /* Discard any data received form remote. */
92 urh->in_buffer_used = 0; 91 urh->in_buffer_used = 0;
@@ -102,11 +101,8 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
102 * fail after remote disconnect was detected) may discard data in system 101 * fail after remote disconnect was detected) may discard data in system
103 * buffers received by system but not yet read by recv(). 102 * buffers received by system but not yet read by recv().
104 * So, before trying send() on any socket, recv() must be performed at first 103 * So, before trying send() on any socket, recv() must be performed at first
105 * otherwise last part of incoming data may be lost. */ 104 * otherwise last part of incoming data may be lost. *//* If disconnect or error was detected - try to read from socket
106 105 * to dry data possibly pending is system buffers. */if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
107 /* If disconnect or error was detected - try to read from socket
108 * to dry data possibly pending is system buffers. */
109 if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
110 urh->app.celi |= MHD_EPOLL_STATE_READ_READY; 106 urh->app.celi |= MHD_EPOLL_STATE_READ_READY;
111 if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) 107 if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi))
112 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; 108 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
@@ -392,6 +388,8 @@ MHD_upgrade_response_handle_process_ (struct MHD_UpgradeResponseHandle *urh)
392 urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; 388 urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
393 } 389 }
394} 390}
391
392
395#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 393#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
396 394
397/* end of upgrade_process.c */ 395/* end of upgrade_process.c */
diff --git a/src/lib/version.c b/src/lib/version.c
index 5bf4ab01..c5ec38e3 100644
--- a/src/lib/version.c
+++ b/src/lib/version.c
@@ -46,7 +46,7 @@ MHD_get_version (void)
46 (((int) MHD_VERSION >> 24) & 0xFF), 46 (((int) MHD_VERSION >> 24) & 0xFF),
47 (((int) MHD_VERSION >> 16) & 0xFF), 47 (((int) MHD_VERSION >> 16) & 0xFF),
48 (((int) MHD_VERSION >> 8) & 0xFF)); 48 (((int) MHD_VERSION >> 8) & 0xFF));
49 if ((0 >= res)||(sizeof(ver) <= res)) 49 if ((0 >= res) || (sizeof(ver) <= res))
50 return "0.0.0"; /* Can't return real version*/ 50 return "0.0.0"; /* Can't return real version*/
51 } 51 }
52 return ver; 52 return ver;
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index f1e38af4..4fba487b 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -143,7 +143,7 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
143 hlen, 143 hlen,
144 "Basic realm=\"%s\"", 144 "Basic realm=\"%s\"",
145 realm); 145 realm);
146 if ((res > 0)&&((size_t) res < hlen)) 146 if ((res > 0) && ((size_t) res < hlen))
147 ret = MHD_add_response_header (response, 147 ret = MHD_add_response_header (response,
148 MHD_HTTP_HEADER_WWW_AUTHENTICATE, 148 MHD_HTTP_HEADER_WWW_AUTHENTICATE,
149 header); 149 header);
@@ -167,4 +167,5 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection *connection,
167 return ret; 167 return ret;
168} 168}
169 169
170
170/* end of basicauth.c */ 171/* end of basicauth.c */
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c63b8d24..fe5efff4 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -175,6 +175,8 @@ MHD_conn_init_static_ (void)
175 } 175 }
176#endif /* SF_FLAGS */ 176#endif /* SF_FLAGS */
177} 177}
178
179
178#endif /* HAVE_FREEBSD_SENDFILE */ 180#endif /* HAVE_FREEBSD_SENDFILE */
179/** 181/**
180 * Callback for receiving data from the socket. 182 * Callback for receiving data from the socket.
@@ -634,10 +636,12 @@ MHD_lookup_header_token_ci (const struct MHD_Connection *connection,
634{ 636{
635 struct MHD_HTTP_Header *pos; 637 struct MHD_HTTP_Header *pos;
636 638
637 if ((NULL == connection)||(NULL == header)||(0 == header[0])||(NULL == 639 if ((NULL == connection) || (NULL == header) || (0 == header[0]) || (NULL ==
638 token) ||(0 == 640 token) ||
639 token 641 (0 ==
640 [0]) ) 642 token
643 [
644 0]) )
641 return false; 645 return false;
642 646
643 for (pos = connection->headers_received; NULL != pos; pos = pos->next) 647 for (pos = connection->headers_received; NULL != pos; pos = pos->next)
@@ -721,8 +725,7 @@ MHD_connection_mark_closed_ (struct MHD_Connection *connection)
721 * and do not shutdown TCP socket. This give more 725 * and do not shutdown TCP socket. This give more
722 * chances to send TLS closure data to remote side. 726 * chances to send TLS closure data to remote side.
723 * Closure of TLS layer will be interpreted by 727 * Closure of TLS layer will be interpreted by
724 * remote side as end of transmission. */ 728 * remote side as end of transmission. */if (0 != (daemon->options & MHD_USE_TLS))
725 if (0 != (daemon->options & MHD_USE_TLS))
726 { 729 {
727 if (! MHD_tls_connection_shutdown (connection)) 730 if (! MHD_tls_connection_shutdown (connection))
728 shutdown (connection->socket_fd, 731 shutdown (connection->socket_fd,
@@ -829,8 +832,9 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
829 * used with MHD_UPGRADE_ACTION_CLOSE. They will be 832 * used with MHD_UPGRADE_ACTION_CLOSE. They will be
830 * closed by MHD_cleanup_upgraded_connection_() during 833 * closed by MHD_cleanup_upgraded_connection_() during
831 * connection's final cleanup. 834 * connection's final cleanup.
832 */ 835 */}
833} 836
837
834#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/ 838#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT*/
835 839
836 840
@@ -999,7 +1003,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
999 = (size_t) (connection->response_write_position - response->data_start); 1003 = (size_t) (connection->response_write_position - response->data_start);
1000 /* buffer already ready, use what is there for the chunk */ 1004 /* buffer already ready, use what is there for the chunk */
1001 ret = response->data_size - data_write_offset; 1005 ret = response->data_size - data_write_offset;
1002 if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2 ) 1006 if ( ((size_t) ret) > connection->write_buffer_size - sizeof (cbuf) - 2)
1003 ret = connection->write_buffer_size - sizeof (cbuf) - 2; 1007 ret = connection->write_buffer_size - sizeof (cbuf) - 2;
1004 memcpy (&connection->write_buffer[sizeof (cbuf)], 1008 memcpy (&connection->write_buffer[sizeof (cbuf)],
1005 &response->data[data_write_offset], 1009 &response->data[data_write_offset],
@@ -1454,8 +1458,7 @@ build_header_response (struct MHD_Connection *connection)
1454 1458
1455 Note that the change from 'SHOULD NOT' to 'MUST NOT' is 1459 Note that the change from 'SHOULD NOT' to 'MUST NOT' is
1456 a recent development of the HTTP 1.1 specification. 1460 a recent development of the HTTP 1.1 specification.
1457 */ 1461 */content_length_len
1458 content_length_len
1459 = MHD_snprintf_ (content_length_buf, 1462 = MHD_snprintf_ (content_length_buf,
1460 sizeof (content_length_buf), 1463 sizeof (content_length_buf),
1461 MHD_HTTP_HEADER_CONTENT_LENGTH ": " 1464 MHD_HTTP_HEADER_CONTENT_LENGTH ": "
@@ -1788,8 +1791,7 @@ MHD_connection_update_event_loop_info (struct MHD_Connection *connection)
1788 or if we do nothing, we would just timeout 1791 or if we do nothing, we would just timeout
1789 on the connection (if a timeout is even 1792 on the connection (if a timeout is even
1790 set!). 1793 set!).
1791 Solution: we kill the connection with an error */ 1794 Solution: we kill the connection with an error */transmit_error_response (connection,
1792 transmit_error_response (connection,
1793 MHD_HTTP_INTERNAL_SERVER_ERROR, 1795 MHD_HTTP_INTERNAL_SERVER_ERROR,
1794 INTERNAL_ERROR); 1796 INTERNAL_ERROR);
1795 continue; 1797 continue;
@@ -2559,8 +2561,7 @@ process_header_line (struct MHD_Connection *connection,
2559 header at the beginning of the while 2561 header at the beginning of the while
2560 loop since we need to be able to inspect 2562 loop since we need to be able to inspect
2561 the *next* header line (in case it starts 2563 the *next* header line (in case it starts
2562 with a space...) */ 2564 with a space...) */connection->last = line;
2563 connection->last = line;
2564 connection->colon = colon; 2565 connection->colon = colon;
2565 return MHD_YES; 2566 return MHD_YES;
2566} 2567}
@@ -2607,8 +2608,7 @@ process_broken_line (struct MHD_Connection *connection,
2607 adjacency); also, in the case where these are not adjacent 2608 adjacency); also, in the case where these are not adjacent
2608 (not sure how it can happen!), we would want to allocate from 2609 (not sure how it can happen!), we would want to allocate from
2609 the end of the pool, so as to not destroy the read-buffer's 2610 the end of the pool, so as to not destroy the read-buffer's
2610 ability to grow nicely. */ 2611 ability to grow nicely. */last = MHD_pool_reallocate (connection->pool,
2611 last = MHD_pool_reallocate (connection->pool,
2612 last, 2612 last,
2613 last_len + 1, 2613 last_len + 1,
2614 last_len + tmp_len + 1); 2614 last_len + tmp_len + 1);
@@ -3804,6 +3804,8 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection)
3804 } 3804 }
3805 return MHD_YES; 3805 return MHD_YES;
3806} 3806}
3807
3808
3807#endif 3809#endif
3808 3810
3809 3811
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 74ebafcb..88f31dbd 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -68,6 +68,7 @@
68 */ 68 */
69void 69void
70MHD_conn_init_static_ (void); 70MHD_conn_init_static_ (void);
71
71#endif /* HAVE_FREEBSD_SENDFILE */ 72#endif /* HAVE_FREEBSD_SENDFILE */
72 73
73 74
@@ -152,6 +153,7 @@ MHD_connection_close_ (struct MHD_Connection *connection,
152 */ 153 */
153void 154void
154MHD_connection_finish_forward_ (struct MHD_Connection *connection); 155MHD_connection_finish_forward_ (struct MHD_Connection *connection);
156
155#else /* ! HTTPS_SUPPORT */ 157#else /* ! HTTPS_SUPPORT */
156#define MHD_connection_finish_forward_(conn) (void) conn 158#define MHD_connection_finish_forward_(conn) (void) conn
157#endif /* ! HTTPS_SUPPORT */ 159#endif /* ! HTTPS_SUPPORT */
@@ -168,6 +170,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection);
168 */ 170 */
169int 171int
170MHD_connection_epoll_update_ (struct MHD_Connection *connection); 172MHD_connection_epoll_update_ (struct MHD_Connection *connection);
173
171#endif 174#endif
172 175
173/** 176/**
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c
index 108e1fc6..fb07deca 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -226,4 +226,5 @@ MHD_tls_connection_shutdown (struct MHD_Connection *connection)
226 return false; 226 return false;
227} 227}
228 228
229
229/* end of connection_https.c */ 230/* end of connection_https.c */
diff --git a/src/microhttpd/connection_https.h b/src/microhttpd/connection_https.h
index 142c8da8..58b7f619 100644
--- a/src/microhttpd/connection_https.h
+++ b/src/microhttpd/connection_https.h
@@ -74,6 +74,7 @@ ssize_t
74send_tls_adapter (struct MHD_Connection *connection, 74send_tls_adapter (struct MHD_Connection *connection,
75 const void *other, 75 const void *other,
76 size_t i); 76 size_t i);
77
77#endif /* HTTPS_SUPPORT */ 78#endif /* HTTPS_SUPPORT */
78 79
79#endif 80#endif
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index aec6aa86..c879a2df 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -216,6 +216,8 @@ MHD_check_global_init_ (void)
216#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */ 216#endif /* MHD_MUTEX_STATIC_DEFN_INIT_ */
217#endif 217#endif
218} 218}
219
220
219#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */ 221#endif /* ! _AUTOINIT_FUNCS_ARE_SUPPORTED */
220 222
221 223
@@ -654,6 +656,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
654 return -1; 656 return -1;
655} 657}
656 658
659
657/** 660/**
658 * Initialize security aspects of the HTTPS daemon 661 * Initialize security aspects of the HTTPS daemon
659 * 662 *
@@ -684,6 +687,8 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
684 return -1; 687 return -1;
685 } 688 }
686} 689}
690
691
687#endif /* HTTPS_SUPPORT */ 692#endif /* HTTPS_SUPPORT */
688 693
689 694
@@ -858,6 +863,7 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh,
858 } 863 }
859} 864}
860 865
866
861#ifdef HAVE_POLL 867#ifdef HAVE_POLL
862 868
863/** 869/**
@@ -950,6 +956,8 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
950 if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR)) 956 if (0 != (p[1].revents & MHD_POLL_REVENTS_ERRROR))
951 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; 957 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY;
952} 958}
959
960
953#endif /* HAVE_POLL */ 961#endif /* HAVE_POLL */
954#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 962#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
955 963
@@ -1236,10 +1244,8 @@ call_handlers (struct MHD_Connection *con,
1236 immediately. 1244 immediately.
1237 As writeability of socket was not checked and it may have 1245 As writeability of socket was not checked and it may have
1238 some data pending in system buffers, use this optimization 1246 some data pending in system buffers, use this optimization
1239 only for non-blocking sockets. */ 1247 only for non-blocking sockets. *//* No need to check 'ret' as connection is always in
1240 /* No need to check 'ret' as connection is always in 1248 * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */else if (on_fasttrack && con->sk_nonblck)
1241 * MHD_CONNECTION_CLOSED state if 'ret' is equal 'MHD_NO'. */
1242 else if (on_fasttrack && con->sk_nonblck)
1243 { 1249 {
1244 if (MHD_CONNECTION_HEADERS_SENDING == con->state) 1250 if (MHD_CONNECTION_HEADERS_SENDING == con->state)
1245 { 1251 {
@@ -1312,6 +1318,8 @@ cleanup_upgraded_connection (struct MHD_Connection *connection)
1312 connection->urh = NULL; 1318 connection->urh = NULL;
1313 free (urh); 1319 free (urh);
1314} 1320}
1321
1322
1315#endif /* UPGRADE_SUPPORT */ 1323#endif /* UPGRADE_SUPPORT */
1316 1324
1317 1325
@@ -1371,8 +1379,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1371 * check for any pending data even if socket is not marked 1379 * check for any pending data even if socket is not marked
1372 * as 'ready' (signal may arrive after poll()/select()). 1380 * as 'ready' (signal may arrive after poll()/select()).
1373 * Socketpair for forwarding is always in non-blocking mode 1381 * Socketpair for forwarding is always in non-blocking mode
1374 * so no risk that recv() will block the thread. */ 1382 * so no risk that recv() will block the thread. */if (0 != urh->out_buffer_size)
1375 if (0 != urh->out_buffer_size)
1376 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; 1383 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
1377 /* Discard any data received form remote. */ 1384 /* Discard any data received form remote. */
1378 urh->in_buffer_used = 0; 1385 urh->in_buffer_used = 0;
@@ -1388,11 +1395,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1388 * fail after remote disconnect was detected) may discard data in system 1395 * fail after remote disconnect was detected) may discard data in system
1389 * buffers received by system but not yet read by recv(). 1396 * buffers received by system but not yet read by recv().
1390 * So, before trying send() on any socket, recv() must be performed at first 1397 * So, before trying send() on any socket, recv() must be performed at first
1391 * otherwise last part of incoming data may be lost. */ 1398 * otherwise last part of incoming data may be lost. *//* If disconnect or error was detected - try to read from socket
1392 1399 * to dry data possibly pending is system buffers. */if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
1393 /* If disconnect or error was detected - try to read from socket
1394 * to dry data possibly pending is system buffers. */
1395 if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi))
1396 urh->app.celi |= MHD_EPOLL_STATE_READ_READY; 1400 urh->app.celi |= MHD_EPOLL_STATE_READ_READY;
1397 if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) 1401 if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi))
1398 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; 1402 urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY;
@@ -1669,6 +1673,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1669 urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY; 1673 urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
1670 } 1674 }
1671} 1675}
1676
1677
1672#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 1678#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
1673 1679
1674#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 1680#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
@@ -1823,6 +1829,8 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
1823 /* Do not set 'urh->clean_ready' yet as 'urh' will be used 1829 /* Do not set 'urh->clean_ready' yet as 'urh' will be used
1824 * in connection thread for a little while. */ 1830 * in connection thread for a little while. */
1825} 1831}
1832
1833
1826#endif /* UPGRADE_SUPPORT */ 1834#endif /* UPGRADE_SUPPORT */
1827 1835
1828 1836
@@ -2182,7 +2190,7 @@ thread_main_handle_connection (void *data)
2182 MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN : 2190 MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN :
2183 MHD_REQUEST_TERMINATED_WITH_ERROR); 2191 MHD_REQUEST_TERMINATED_WITH_ERROR);
2184 MHD_connection_handle_idle (con); 2192 MHD_connection_handle_idle (con);
2185 exit: 2193exit:
2186 if (NULL != con->response) 2194 if (NULL != con->response)
2187 { 2195 {
2188 MHD_destroy_response (con->response); 2196 MHD_destroy_response (con->response);
@@ -2208,6 +2216,8 @@ thread_main_handle_connection (void *data)
2208 } 2216 }
2209 return (MHD_THRD_RTRN_TYPE_) 0; 2217 return (MHD_THRD_RTRN_TYPE_) 0;
2210} 2218}
2219
2220
2211#endif 2221#endif
2212 2222
2213 2223
@@ -2248,6 +2258,8 @@ MHD_tls_push_func_ (gnutls_transport_ptr_t trnsp,
2248#endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */ 2258#endif /* (MHD_SCKT_SEND_MAX_SIZE_ < SSIZE_MAX) || (0 == SSIZE_MAX) */
2249 return MHD_send_ ((MHD_socket) (intptr_t) (trnsp), data, data_size); 2259 return MHD_send_ ((MHD_socket) (intptr_t) (trnsp), data, data_size);
2250} 2260}
2261
2262
2251#endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */ 2263#endif /* MHD_TLSLIB_DONT_SUPPRESS_SIGPIPE */
2252 2264
2253 2265
@@ -2327,6 +2339,8 @@ psk_gnutls_adapter (gnutls_session_t session,
2327 return -1; 2339 return -1;
2328#endif 2340#endif
2329} 2341}
2342
2343
2330#endif /* HTTPS_SUPPORT */ 2344#endif /* HTTPS_SUPPORT */
2331 2345
2332 2346
@@ -2742,7 +2756,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
2742#endif 2756#endif
2743 } 2757 }
2744 return MHD_YES; 2758 return MHD_YES;
2745 cleanup: 2759cleanup:
2746 if (NULL != daemon->notify_connection) 2760 if (NULL != daemon->notify_connection)
2747 daemon->notify_connection (daemon->notify_connection_cls, 2761 daemon->notify_connection (daemon->notify_connection_cls,
2748 connection, 2762 connection,
@@ -3223,7 +3237,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
3223 { 3237 {
3224 MHD_socket_close_chk_ (s); 3238 MHD_socket_close_chk_ (s);
3225 } 3239 }
3226 if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) ) 3240 if (MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
3227 { 3241 {
3228 /* system/process out of resources */ 3242 /* system/process out of resources */
3229 if (0 == daemon->connections) 3243 if (0 == daemon->connections)
@@ -3375,8 +3389,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
3375 this is not true as if we fail to do manually remove it, 3389 this is not true as if we fail to do manually remove it,
3376 we are still seeing an event for this fd in epoll, 3390 we are still seeing an event for this fd in epoll,
3377 causing grief (use-after-free...) --- at least on my 3391 causing grief (use-after-free...) --- at least on my
3378 system. */ 3392 system. */if (0 != epoll_ctl (daemon->epoll_fd,
3379 if (0 != epoll_ctl (daemon->epoll_fd,
3380 EPOLL_CTL_DEL, 3393 EPOLL_CTL_DEL,
3381 pos->socket_fd, 3394 pos->socket_fd,
3382 NULL)) 3395 NULL))
@@ -3632,7 +3645,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
3632 if (0 != (daemon->options 3645 if (0 != (daemon->options
3633 & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) ) 3646 & (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) )
3634 return MHD_NO; 3647 return MHD_NO;
3635 if ((NULL == read_fd_set)||(NULL == write_fd_set)) 3648 if ((NULL == read_fd_set) || (NULL == write_fd_set))
3636 return MHD_NO; 3649 return MHD_NO;
3637 if (NULL == except_fd_set) 3650 if (NULL == except_fd_set)
3638 { /* Workaround to maintain backward compatibility. */ 3651 { /* Workaround to maintain backward compatibility. */
@@ -3770,6 +3783,8 @@ MHD_select (struct MHD_Daemon *daemon,
3770#if defined(MHD_WINSOCK_SOCKETS) 3783#if defined(MHD_WINSOCK_SOCKETS)
3771 } 3784 }
3772} 3785}
3786
3787
3773#endif /* MHD_WINSOCK_SOCKETS */ 3788#endif /* MHD_WINSOCK_SOCKETS */
3774 } 3789 }
3775 /* Stop listening if we are at the configured connection limit */ 3790 /* Stop listening if we are at the configured connection limit */
@@ -4130,6 +4145,8 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
4130 (void) MHD_accept_connection (daemon); 4145 (void) MHD_accept_connection (daemon);
4131 return MHD_YES; 4146 return MHD_YES;
4132} 4147}
4148
4149
4133#endif 4150#endif
4134 4151
4135 4152
@@ -4319,6 +4336,8 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
4319 4336
4320 return MHD_YES; 4337 return MHD_YES;
4321} 4338}
4339
4340
4322#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 4341#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
4323 4342
4324 4343
@@ -4607,8 +4626,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
4607 here. 4626 here.
4608 4627
4609 Connections with custom timeouts must all be looked at, as we 4628 Connections with custom timeouts must all be looked at, as we
4610 do not bother to sort that (presumably very short) list. */ 4629 do not bother to sort that (presumably very short) list. */prev = daemon->manual_timeout_tail;
4611 prev = daemon->manual_timeout_tail;
4612 while (NULL != (pos = prev)) 4630 while (NULL != (pos = prev))
4613 { 4631 {
4614 prev = pos->prevX; 4632 prev = pos->prevX;
@@ -4628,6 +4646,8 @@ MHD_epoll (struct MHD_Daemon *daemon,
4628 } 4646 }
4629 return MHD_YES; 4647 return MHD_YES;
4630} 4648}
4649
4650
4631#endif 4651#endif
4632 4652
4633 4653
@@ -4759,6 +4779,8 @@ MHD_polling_thread (void *cls)
4759 4779
4760 return (MHD_THRD_RTRN_TYPE_) 0; 4780 return (MHD_THRD_RTRN_TYPE_) 0;
4761} 4781}
4782
4783
4762#endif 4784#endif
4763 4785
4764 4786
@@ -5644,6 +5666,8 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
5644 } 5666 }
5645 return MHD_YES; 5667 return MHD_YES;
5646} 5668}
5669
5670
5647#endif 5671#endif
5648 5672
5649 5673
@@ -6553,7 +6577,7 @@ MHD_start_daemon_va (unsigned int flags,
6553 return daemon; 6577 return daemon;
6554 6578
6555#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 6579#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
6556 thread_failed: 6580thread_failed:
6557 /* If no worker threads created, then shut down normally. Calling 6581 /* If no worker threads created, then shut down normally. Calling
6558 MHD_stop_daemon (as we do below) doesn't work here since it 6582 MHD_stop_daemon (as we do below) doesn't work here since it
6559 assumes a 0-sized thread pool means we had been in the default 6583 assumes a 0-sized thread pool means we had been in the default
@@ -6577,7 +6601,7 @@ MHD_start_daemon_va (unsigned int flags,
6577 return NULL; 6601 return NULL;
6578#endif 6602#endif
6579 6603
6580 free_and_fail: 6604free_and_fail:
6581 /* clean up basic memory state in 'daemon' and return NULL to 6605 /* clean up basic memory state in 'daemon' and return NULL to
6582 indicate failure */ 6606 indicate failure */
6583#ifdef EPOLL_SUPPORT 6607#ifdef EPOLL_SUPPORT
@@ -7053,7 +7077,7 @@ MHD_get_version (void)
7053 (((int) MHD_VERSION >> 24) & 0xFF), 7077 (((int) MHD_VERSION >> 24) & 0xFF),
7054 (((int) MHD_VERSION >> 16) & 0xFF), 7078 (((int) MHD_VERSION >> 16) & 0xFF),
7055 (((int) MHD_VERSION >> 8) & 0xFF)); 7079 (((int) MHD_VERSION >> 8) & 0xFF));
7056 if ((0 >= res)||(sizeof(ver) <= res)) 7080 if ((0 >= res) || (sizeof(ver) <= res))
7057 return "0.0.0"; /* Can't return real version*/ 7081 return "0.0.0"; /* Can't return real version*/
7058 } 7082 }
7059 return ver; 7083 return ver;
@@ -7301,7 +7325,7 @@ MHD_init (void)
7301 if (0 != WSAStartup (MAKEWORD (2, 2), &wsd)) 7325 if (0 != WSAStartup (MAKEWORD (2, 2), &wsd))
7302 MHD_PANIC (_ ("Failed to initialize winsock\n")); 7326 MHD_PANIC (_ ("Failed to initialize winsock\n"));
7303 mhd_winsock_inited_ = 1; 7327 mhd_winsock_inited_ = 1;
7304 if ((2 != LOBYTE (wsd.wVersion))&&(2 != HIBYTE (wsd.wVersion))) 7328 if ((2 != LOBYTE (wsd.wVersion)) && (2 != HIBYTE (wsd.wVersion)))
7305 MHD_PANIC (_ ("Winsock version 2.2 is not available\n")); 7329 MHD_PANIC (_ ("Winsock version 2.2 is not available\n"));
7306#endif /* MHD_WINSOCK_SOCKETS */ 7330#endif /* MHD_WINSOCK_SOCKETS */
7307#ifdef HTTPS_SUPPORT 7331#ifdef HTTPS_SUPPORT
@@ -7346,6 +7370,7 @@ MHD_fini (void)
7346 MHD_monotonic_sec_counter_finish (); 7370 MHD_monotonic_sec_counter_finish ();
7347} 7371}
7348 7372
7373
7349#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED 7374#ifdef _AUTOINIT_FUNCS_ARE_SUPPORTED
7350_SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini); 7375_SET_INIT_AND_DEINIT_FUNCS (MHD_init, MHD_fini);
7351#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */ 7376#endif /* _AUTOINIT_FUNCS_ARE_SUPPORTED */
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 95aee7b4..fe078009 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -555,8 +555,7 @@ check_nonce_nc (struct MHD_Connection *connection,
555 * Look for the nonce, if it does exist and its corresponding 555 * Look for the nonce, if it does exist and its corresponding
556 * nonce counter is less than the current nonce counter by 1, 556 * nonce counter is less than the current nonce counter by 1,
557 * then only increase the nonce counter by one. 557 * then only increase the nonce counter by one.
558 */ 558 */nn = &daemon->nnc[off];
559 nn = &daemon->nnc[off];
560#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 559#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
561 MHD_mutex_lock_chk_ (&daemon->nnc_lock); 560 MHD_mutex_lock_chk_ (&daemon->nnc_lock);
562#endif 561#endif
@@ -938,8 +937,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
938 large, but of course in theory the 937 large, but of course in theory the
939 #MHD_OPTION_CONNECTION_MEMORY_LIMIT might be very large 938 #MHD_OPTION_CONNECTION_MEMORY_LIMIT might be very large
940 and would thus permit sending a >32k authorization 939 and would thus permit sending a >32k authorization
941 header value. */ 940 header value. */return MHD_NO;
942 return MHD_NO;
943 } 941 }
944 if (TIMESTAMP_BIN_SIZE * 2 != 942 if (TIMESTAMP_BIN_SIZE * 2 !=
945 MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_BIN_SIZE * 2, 943 MHD_strx_to_uint32_n_ (nonce + len - TIMESTAMP_BIN_SIZE * 2,
@@ -957,8 +955,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
957 * First level vetting for the nonce validity: if the timestamp 955 * First level vetting for the nonce validity: if the timestamp
958 * attached to the nonce exceeds `nonce_timeout', then the nonce is 956 * attached to the nonce exceeds `nonce_timeout', then the nonce is
959 * invalid. 957 * invalid.
960 */ 958 */if ( (t > nonce_time + nonce_timeout) ||
961 if ( (t > nonce_time + nonce_timeout) ||
962 (nonce_time + nonce_timeout < nonce_time) ) 959 (nonce_time + nonce_timeout < nonce_time) )
963 { 960 {
964 /* too old */ 961 /* too old */
@@ -981,9 +978,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
981 * able to generate a "sane" nonce, which if he does 978 * able to generate a "sane" nonce, which if he does
982 * not, the nonce fabrication process going to be 979 * not, the nonce fabrication process going to be
983 * very hard to achieve. 980 * very hard to achieve.
984 */ 981 */if (0 != strcmp (nonce,
985
986 if (0 != strcmp (nonce,
987 noncehashexp)) 982 noncehashexp))
988 { 983 {
989 return MHD_INVALID_NONCE; 984 return MHD_INVALID_NONCE;
@@ -1003,7 +998,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
1003 (0 == (len = lookup_sub_value (nc, 998 (0 == (len = lookup_sub_value (nc,
1004 sizeof (nc), 999 sizeof (nc),
1005 header, 1000 header,
1006 "nc")) ) || 1001 "nc")) ) ||
1007 (0 == lookup_sub_value (response, 1002 (0 == lookup_sub_value (response,
1008 sizeof (response), 1003 sizeof (response),
1009 header, 1004 header,
@@ -1030,8 +1025,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
1030 * Checking if that combination of nonce and nc is sound 1025 * Checking if that combination of nonce and nc is sound
1031 * and not a replay attack attempt. Also adds the nonce 1026 * and not a replay attack attempt. Also adds the nonce
1032 * to the nonce-nc map if it does not exist there. 1027 * to the nonce-nc map if it does not exist there.
1033 */ 1028 */if (MHD_YES !=
1034 if (MHD_YES !=
1035 check_nonce_nc (connection, 1029 check_nonce_nc (connection,
1036 nonce, 1030 nonce,
1037 nci)) 1031 nci))
@@ -1219,7 +1213,6 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
1219 } while (0) 1213 } while (0)
1220 1214
1221 1215
1222
1223/** 1216/**
1224 * Authenticates the authorization header sent by the client. 1217 * Authenticates the authorization header sent by the client.
1225 * 1218 *
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index 109ebfe2..b8d8f540 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -81,6 +81,8 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
81 return "unrecognized connection state"; 81 return "unrecognized connection state";
82 } 82 }
83} 83}
84
85
84#endif 86#endif
85#endif 87#endif
86 88
@@ -105,6 +107,8 @@ MHD_DLOG (const struct MHD_Daemon *daemon,
105 va); 107 va);
106 va_end (va); 108 va_end (va);
107} 109}
110
111
108#endif 112#endif
109 113
110 114
@@ -288,4 +292,5 @@ MHD_parse_arguments_ (struct MHD_Connection *connection,
288 return MHD_YES; 292 return MHD_YES;
289} 293}
290 294
295
291/* end of internal.c */ 296/* end of internal.c */
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 8f7192e7..211eed9f 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -255,6 +255,7 @@ void
255MHD_DLOG (const struct MHD_Daemon *daemon, 255MHD_DLOG (const struct MHD_Daemon *daemon,
256 const char *format, 256 const char *format,
257 ...); 257 ...);
258
258#endif 259#endif
259 260
260 261
@@ -562,6 +563,7 @@ enum MHD_TLS_CONN_STATE
562#if DEBUG_STATES 563#if DEBUG_STATES
563const char * 564const char *
564MHD_state_to_string (enum MHD_CONNECTION_STATE state); 565MHD_state_to_string (enum MHD_CONNECTION_STATE state);
566
565#endif 567#endif
566#endif 568#endif
567 569
@@ -1802,7 +1804,6 @@ struct MHD_Daemon
1802 (element)->prev = NULL; } while (0) 1804 (element)->prev = NULL; } while (0)
1803 1805
1804 1806
1805
1806/** 1807/**
1807 * Insert an element at the head of a XDLL. Assumes that head, tail and 1808 * Insert an element at the head of a XDLL. Assumes that head, tail and
1808 * element are structs with prevX and nextX fields. 1809 * element are structs with prevX and nextX fields.
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 39b66185..05a2c9e6 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -46,6 +46,7 @@ MHD_MD5Init (void *ctx_)
46 ctx->state[3] = 0x10325476; 46 ctx->state[3] = 0x10325476;
47} 47}
48 48
49
49static void 50static void
50MD5Transform (uint32_t state[4], 51MD5Transform (uint32_t state[4],
51 const uint8_t block[MD5_BLOCK_SIZE]); 52 const uint8_t block[MD5_BLOCK_SIZE]);
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index ddfd08d3..57e49cf0 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -100,6 +100,7 @@ MHD_init_mem_pools_ (void)
100#endif /* _WIN32 */ 100#endif /* _WIN32 */
101} 101}
102 102
103
103/** 104/**
104 * Handle for a memory pool. Pools are not reentrant and must not be 105 * Handle for a memory pool. Pools are not reentrant and must not be
105 * used by multiple threads. 106 * used by multiple threads.
diff --git a/src/microhttpd/mhd_byteorder.h b/src/microhttpd/mhd_byteorder.h
index f1f03f44..73c14240 100644
--- a/src/microhttpd/mhd_byteorder.h
+++ b/src/microhttpd/mhd_byteorder.h
@@ -125,7 +125,7 @@
125 defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__) 125 defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__)
126/* x86 family is little endian */ 126/* x86 family is little endian */
127#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN 127#define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN
128#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \ 128#elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
129 defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) 129 defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__)
130/* Looks like we are on ARM/MIPS in big endian mode */ 130/* Looks like we are on ARM/MIPS in big endian mode */
131#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN 131#define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN
diff --git a/src/microhttpd/mhd_compat.c b/src/microhttpd/mhd_compat.c
index 6f6c6f9c..fd8132ac 100644
--- a/src/microhttpd/mhd_compat.c
+++ b/src/microhttpd/mhd_compat.c
@@ -79,6 +79,7 @@ W32_snprintf (char *__restrict s,
79 return ret; 79 return ret;
80} 80}
81 81
82
82#endif /* HAVE_SNPRINTF */ 83#endif /* HAVE_SNPRINTF */
83#endif /* _WIN32 && !__CYGWIN__ */ 84#endif /* _WIN32 && !__CYGWIN__ */
84 85
@@ -93,16 +94,17 @@ W32_snprintf (char *__restrict s,
93#endif /* __GNUC__ >= 5 */ 94#endif /* __GNUC__ >= 5 */
94 95
95 96
96void *MHD_calloc_ (size_t nelem, size_t elsize) 97void *
98MHD_calloc_ (size_t nelem, size_t elsize)
97{ 99{
98 size_t alloc_size; 100 size_t alloc_size;
99 void *ptr; 101 void *ptr;
100#ifdef MHD_HAVE_NUL_OVERFLOW 102#ifdef MHD_HAVE_NUL_OVERFLOW
101 if (__builtin_mul_overflow (nelem, elsize, &alloc_size) ||(0 == alloc_size)) 103 if (__builtin_mul_overflow (nelem, elsize, &alloc_size) || (0 == alloc_size))
102 return NULL; 104 return NULL;
103#else /* ! MHD_HAVE_NUL_OVERFLOW */ 105#else /* ! MHD_HAVE_NUL_OVERFLOW */
104 alloc_size = nelem * elsize; 106 alloc_size = nelem * elsize;
105 if ((0 == alloc_size)||(elsize != alloc_size / nelem)) 107 if ((0 == alloc_size) || (elsize != alloc_size / nelem))
106 return NULL; 108 return NULL;
107#endif /* ! MHD_HAVE_NUL_OVERFLOW */ 109#endif /* ! MHD_HAVE_NUL_OVERFLOW */
108 ptr = malloc (alloc_size); 110 ptr = malloc (alloc_size);
@@ -111,4 +113,6 @@ void *MHD_calloc_ (size_t nelem, size_t elsize)
111 memset (ptr, 0, alloc_size); 113 memset (ptr, 0, alloc_size);
112 return ptr; 114 return ptr;
113} 115}
116
117
114#endif /* ! HAVE_CALLOC */ 118#endif /* ! HAVE_CALLOC */
diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h
index 6b38a03e..4062c101 100644
--- a/src/microhttpd/mhd_compat.h
+++ b/src/microhttpd/mhd_compat.h
@@ -51,6 +51,7 @@
51/* Emulate snprintf function on W32 */ 51/* Emulate snprintf function on W32 */
52int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format, 52int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
53 ...); 53 ...);
54
54#define MHD_snprintf_ W32_snprintf 55#define MHD_snprintf_ W32_snprintf
55#else /* ! _WIN32 || __CYGWIN__ */ 56#else /* ! _WIN32 || __CYGWIN__ */
56#error \ 57#error \
@@ -84,6 +85,7 @@ int W32_snprintf (char *__restrict s, size_t n, const char *__restrict format,
84 * MHD_calloc_ is platform-independent calloc() 85 * MHD_calloc_ is platform-independent calloc()
85 */ 86 */
86void *MHD_calloc_ (size_t nelem, size_t elsize); 87void *MHD_calloc_ (size_t nelem, size_t elsize);
88
87#endif /* ! HAVE_CALLOC */ 89#endif /* ! HAVE_CALLOC */
88 90
89#endif /* MHD_COMPAT_H */ 91#endif /* MHD_COMPAT_H */
diff --git a/src/microhttpd/mhd_itc.c b/src/microhttpd/mhd_itc.c
index 6c81ef62..ef5e49bd 100644
--- a/src/microhttpd/mhd_itc.c
+++ b/src/microhttpd/mhd_itc.c
@@ -65,6 +65,8 @@ MHD_itc_nonblocking_ (struct MHD_itc_ itc)
65 } 65 }
66 return ! 0; 66 return ! 0;
67} 67}
68
69
68#endif /* ! HAVE_PIPE2_FUNC */ 70#endif /* ! HAVE_PIPE2_FUNC */
69#endif /* !_WIN32 || __CYGWIN__ */ 71#endif /* !_WIN32 || __CYGWIN__ */
70#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */ 72#endif /* _MHD_ITC_EVENTFD || _MHD_ITC_PIPE */
diff --git a/src/microhttpd/mhd_itc.h b/src/microhttpd/mhd_itc.h
index 8e303ef9..a7cad0e1 100644
--- a/src/microhttpd/mhd_itc.h
+++ b/src/microhttpd/mhd_itc.h
@@ -242,6 +242,7 @@ static const uint64_t _MHD_itc_wr_data = 1;
242 */ 242 */
243int 243int
244MHD_itc_nonblocking_ (struct MHD_itc_ itc); 244MHD_itc_nonblocking_ (struct MHD_itc_ itc);
245
245#endif /* ! HAVE_PIPE2_FUNC */ 246#endif /* ! HAVE_PIPE2_FUNC */
246 247
247 248
diff --git a/src/microhttpd/mhd_mono_clock.c b/src/microhttpd/mhd_mono_clock.c
index eee911fb..fa548f6e 100644
--- a/src/microhttpd/mhd_mono_clock.c
+++ b/src/microhttpd/mhd_mono_clock.c
@@ -94,7 +94,6 @@ static int64_t perf_start;
94#endif /* _WIN32 */ 94#endif /* _WIN32 */
95 95
96 96
97
98/** 97/**
99 * Type of monotonic clock source 98 * Type of monotonic clock source
100 */ 99 */
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index db621cb2..371da6c0 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -448,6 +448,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
448#endif 448#endif
449} 449}
450 450
451
451/** 452/**
452 * sendfile() chuck size 453 * sendfile() chuck size
453 */ 454 */
@@ -561,8 +562,7 @@ MHD_send_sendfile_ (struct MHD_Connection *connection)
561 supported for FD or other 'unusual' errors occurred, so we should try 562 supported for FD or other 'unusual' errors occurred, so we should try
562 to fall back to 'SEND'; see also this thread for info on 563 to fall back to 'SEND'; see also this thread for info on
563 odd libc/Linux behavior with sendfile: 564 odd libc/Linux behavior with sendfile:
564 http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ 565 http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */connection->resp_sender = MHD_resp_sender_std;
565 connection->resp_sender = MHD_resp_sender_std;
566 return MHD_ERR_AGAIN_; 566 return MHD_ERR_AGAIN_;
567#else /* HAVE_SOLARIS_SENDFILE */ 567#else /* HAVE_SOLARIS_SENDFILE */
568 if ( (EAFNOSUPPORT == err) || 568 if ( (EAFNOSUPPORT == err) ||
@@ -662,4 +662,6 @@ MHD_send_sendfile_ (struct MHD_Connection *connection)
662 662
663 return ret; 663 return ret;
664} 664}
665
666
665#endif /* _MHD_HAVE_SENDFILE */ 667#endif /* _MHD_HAVE_SENDFILE */
diff --git a/src/microhttpd/mhd_send.h b/src/microhttpd/mhd_send.h
index 87e584a8..22d934b3 100644
--- a/src/microhttpd/mhd_send.h
+++ b/src/microhttpd/mhd_send.h
@@ -94,6 +94,7 @@ MHD_send_on_connection2_ (struct MHD_Connection *connection,
94#if defined(_MHD_HAVE_SENDFILE) 94#if defined(_MHD_HAVE_SENDFILE)
95ssize_t 95ssize_t
96MHD_send_sendfile_ (struct MHD_Connection *connection); 96MHD_send_sendfile_ (struct MHD_Connection *connection);
97
97#endif 98#endif
98 99
99#endif /* MHD_SEND_H */ 100#endif /* MHD_SEND_H */
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index ad2f91bc..7172f8ee 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -37,7 +37,8 @@
37 * @param err the WinSock error code. 37 * @param err the WinSock error code.
38 * @return pointer to string description of specified WinSock error. 38 * @return pointer to string description of specified WinSock error.
39 */ 39 */
40const char*MHD_W32_strerror_winsock_ (int err) 40const char*
41MHD_W32_strerror_winsock_ (int err)
41{ 42{
42 switch (err) 43 switch (err)
43 { 44 {
@@ -358,6 +359,7 @@ MHD_W32_socket_pair_ (SOCKET sockets_pair[2], int non_blk)
358 return 0; 359 return 0;
359} 360}
360 361
362
361#endif /* MHD_WINSOCK_SOCKETS */ 363#endif /* MHD_WINSOCK_SOCKETS */
362 364
363 365
@@ -515,7 +517,7 @@ MHD_socket_cork_ (MHD_socket sock,
515 (const void *) (on ? &on_val : &off_val), 517 (const void *) (on ? &on_val : &off_val),
516 sizeof (off_val))) 518 sizeof (off_val)))
517 return 0; /* failed */ 519 return 0; /* failed */
518#if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9 520#if defined(__FreeBSD__) && __FreeBSD__ + 0 >= 9
519 /* FreeBSD do not need zero-send for flushing starting from version 9 */ 521 /* FreeBSD do not need zero-send for flushing starting from version 9 */
520 return 1; 522 return 1;
521#elif defined(TCP_NOPUSH) && ! defined(TCP_CORK) 523#elif defined(TCP_NOPUSH) && ! defined(TCP_CORK)
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index 3099357b..aaf58e4a 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -554,6 +554,7 @@ typedef int MHD_SCKT_SEND_SIZE_;
554 * @return pointer to string description of specified WinSock error. 554 * @return pointer to string description of specified WinSock error.
555 */ 555 */
556const char*MHD_W32_strerror_winsock_ (int err); 556const char*MHD_W32_strerror_winsock_ (int err);
557
557#endif /* MHD_WINSOCK_SOCKETS */ 558#endif /* MHD_WINSOCK_SOCKETS */
558 559
559/* MHD_socket_last_strerr_ is description string of specified socket error code */ 560/* MHD_socket_last_strerr_ is description string of specified socket error code */
diff --git a/src/microhttpd/mhd_str.c b/src/microhttpd/mhd_str.c
index 80f0b82e..08162fb2 100644
--- a/src/microhttpd/mhd_str.c
+++ b/src/microhttpd/mhd_str.c
@@ -63,6 +63,8 @@ isasciilower (char c)
63{ 63{
64 return (c >= 'a') && (c <= 'z'); 64 return (c >= 'a') && (c <= 'z');
65} 65}
66
67
66#endif /* Disable unused functions. */ 68#endif /* Disable unused functions. */
67 69
68 70
@@ -91,6 +93,8 @@ isasciialpha (char c)
91{ 93{
92 return isasciilower (c) || isasciiupper (c); 94 return isasciilower (c) || isasciiupper (c);
93} 95}
96
97
94#endif /* Disable unused functions. */ 98#endif /* Disable unused functions. */
95 99
96 100
@@ -106,6 +110,7 @@ isasciidigit (char c)
106 return (c >= '0') && (c <= '9'); 110 return (c >= '0') && (c <= '9');
107} 111}
108 112
113
109#if 0 /* Disable unused functions. */ 114#if 0 /* Disable unused functions. */
110/** 115/**
111 * Check whether character is hexadecimal digit in US-ASCII 116 * Check whether character is hexadecimal digit in US-ASCII
@@ -133,6 +138,8 @@ isasciialnum (char c)
133{ 138{
134 return isasciialpha (c) || isasciidigit (c); 139 return isasciialpha (c) || isasciidigit (c);
135} 140}
141
142
136#endif /* Disable unused functions. */ 143#endif /* Disable unused functions. */
137 144
138 145
@@ -167,6 +174,8 @@ toasciiupper (char c)
167{ 174{
168 return isasciilower (c) ? (c - 'a' + 'A') : c; 175 return isasciilower (c) ? (c - 'a' + 'A') : c;
169} 176}
177
178
170#endif /* Disable unused functions. */ 179#endif /* Disable unused functions. */
171 180
172 181
@@ -185,6 +194,8 @@ todigitvalue (char c)
185 194
186 return -1; 195 return -1;
187} 196}
197
198
188#endif /* MHD_FAVOR_SMALL_CODE */ 199#endif /* MHD_FAVOR_SMALL_CODE */
189 200
190 201
@@ -206,6 +217,8 @@ toxdigitvalue (char c)
206 217
207 return -1; 218 return -1;
208} 219}
220
221
209#else /* !INLINE_FUNC */ 222#else /* !INLINE_FUNC */
210 223
211 224
@@ -345,6 +358,8 @@ MHD_str_equal_caseless_ (const char *str1,
345 } 358 }
346 return 0 == (*str2); 359 return 0 == (*str2);
347} 360}
361
362
348#endif /* ! MHD_FAVOR_SMALL_CODE */ 363#endif /* ! MHD_FAVOR_SMALL_CODE */
349 364
350 365
@@ -408,7 +423,6 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1,
408} 423}
409 424
410 425
411
412/** 426/**
413 * Check whether @a str has case-insensitive @a token. 427 * Check whether @a str has case-insensitive @a token.
414 * Token could be surrounded by spaces and tabs and delimited by comma. 428 * Token could be surrounded by spaces and tabs and delimited by comma.
@@ -456,7 +470,7 @@ MHD_str_has_token_caseless_ (const char *str,
456 while (' ' == *str || '\t' == *str) 470 while (' ' == *str || '\t' == *str)
457 str++; 471 str++;
458 /* End of (sub)string? */ 472 /* End of (sub)string? */
459 if ((0 == *str) ||(',' == *str) ) 473 if ((0 == *str) || (',' == *str) )
460 return true; 474 return true;
461 /* Unmatched chars at end of substring. */ 475 /* Unmatched chars at end of substring. */
462 break; 476 break;
@@ -469,6 +483,7 @@ MHD_str_has_token_caseless_ (const char *str,
469 return false; 483 return false;
470} 484}
471 485
486
472#ifndef MHD_FAVOR_SMALL_CODE 487#ifndef MHD_FAVOR_SMALL_CODE
473/* Use individual function for each case */ 488/* Use individual function for each case */
474 489
@@ -583,8 +598,8 @@ MHD_strx_to_uint32_ (const char *str,
583 while (digit >= 0) 598 while (digit >= 0)
584 { 599 {
585 if ( (res < (UINT32_MAX / 16)) || 600 if ( (res < (UINT32_MAX / 16)) ||
586 ((res == (UINT32_MAX / 16)) &&( (uint32_t) digit <= (UINT32_MAX 601 ((res == (UINT32_MAX / 16)) && ( (uint32_t) digit <= (UINT32_MAX
587 % 16)) ) ) 602 % 16)) ) )
588 { 603 {
589 res *= 16; 604 res *= 16;
590 res += digit; 605 res += digit;
@@ -630,8 +645,8 @@ MHD_strx_to_uint32_n_ (const char *str,
630 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) 645 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
631 { 646 {
632 if ( (res > (UINT32_MAX / 16)) || 647 if ( (res > (UINT32_MAX / 16)) ||
633 ((res == (UINT32_MAX / 16)) &&( (uint32_t) digit > (UINT32_MAX 648 ((res == (UINT32_MAX / 16)) && ( (uint32_t) digit > (UINT32_MAX
634 % 16)) ) ) 649 % 16)) ) )
635 return 0; 650 return 0;
636 651
637 res *= 16; 652 res *= 16;
@@ -670,8 +685,8 @@ MHD_strx_to_uint64_ (const char *str,
670 while (digit >= 0) 685 while (digit >= 0)
671 { 686 {
672 if ( (res < (UINT64_MAX / 16)) || 687 if ( (res < (UINT64_MAX / 16)) ||
673 ((res == (UINT64_MAX / 16)) &&( (uint64_t) digit <= (UINT64_MAX 688 ((res == (UINT64_MAX / 16)) && ( (uint64_t) digit <= (UINT64_MAX
674 % 16)) ) ) 689 % 16)) ) )
675 { 690 {
676 res *= 16; 691 res *= 16;
677 res += digit; 692 res += digit;
@@ -717,8 +732,8 @@ MHD_strx_to_uint64_n_ (const char *str,
717 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0) 732 while (i < maxlen && (digit = toxdigitvalue (str[i])) >= 0)
718 { 733 {
719 if ( (res > (UINT64_MAX / 16)) || 734 if ( (res > (UINT64_MAX / 16)) ||
720 ((res == (UINT64_MAX / 16)) &&( (uint64_t) digit > (UINT64_MAX 735 ((res == (UINT64_MAX / 16)) && ( (uint64_t) digit > (UINT64_MAX
721 % 16)) ) ) 736 % 16)) ) )
722 return 0; 737 return 0;
723 738
724 res *= 16; 739 res *= 16;
@@ -731,6 +746,7 @@ MHD_strx_to_uint64_n_ (const char *str,
731 return i; 746 return i;
732} 747}
733 748
749
734#else /* MHD_FAVOR_SMALL_CODE */ 750#else /* MHD_FAVOR_SMALL_CODE */
735 751
736/** 752/**
@@ -767,8 +783,8 @@ MHD_str_to_uvalue_n_ (const char *str,
767 int (*const dfunc)(char) = (base == 16) ? 783 int (*const dfunc)(char) = (base == 16) ?
768 toxdigitvalue : todigitvalue; 784 toxdigitvalue : todigitvalue;
769 785
770 if ( ! str || ! out_val || 786 if (! str || ! out_val ||
771 ((base != 16)&&(base != 10)) ) 787 ((base != 16) && (base != 10)) )
772 return 0; 788 return 0;
773 789
774 res = 0; 790 res = 0;
@@ -776,7 +792,7 @@ MHD_str_to_uvalue_n_ (const char *str,
776 while (maxlen > i && 0 <= (digit = dfunc (str[i]))) 792 while (maxlen > i && 0 <= (digit = dfunc (str[i])))
777 { 793 {
778 if ( ((max_v_div_b) < res) || 794 if ( ((max_v_div_b) < res) ||
779 (( (max_v_div_b) == res) &&( (max_v_mod_b) < (uint64_t) digit) ) ) 795 (( (max_v_div_b) == res) && ( (max_v_mod_b) < (uint64_t) digit) ) )
780 return 0; 796 return 0;
781 797
782 res *= base; 798 res *= base;
@@ -795,4 +811,6 @@ MHD_str_to_uvalue_n_ (const char *str,
795 } 811 }
796 return i; 812 return i;
797} 813}
814
815
798#endif /* MHD_FAVOR_SMALL_CODE */ 816#endif /* MHD_FAVOR_SMALL_CODE */
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h
index dd379f52..25eeb05e 100644
--- a/src/microhttpd/mhd_str.h
+++ b/src/microhttpd/mhd_str.h
@@ -60,6 +60,7 @@
60int 60int
61MHD_str_equal_caseless_ (const char *str1, 61MHD_str_equal_caseless_ (const char *str1,
62 const char *str2); 62 const char *str2);
63
63#else /* MHD_FAVOR_SMALL_CODE */ 64#else /* MHD_FAVOR_SMALL_CODE */
64/* Reuse MHD_str_equal_caseless_n_() to reduce size */ 65/* Reuse MHD_str_equal_caseless_n_() to reduce size */
65#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \ 66#define MHD_str_equal_caseless_(s1,s2) MHD_str_equal_caseless_n_ ((s1),(s2), \
diff --git a/src/microhttpd/mhd_threads.c b/src/microhttpd/mhd_threads.c
index 6be4cb44..6e96f860 100644
--- a/src/microhttpd/mhd_threads.c
+++ b/src/microhttpd/mhd_threads.c
@@ -80,8 +80,7 @@ MHD_set_thread_name_ (const MHD_thread_ID_ thread_id,
80 * third argument is single argument for printf; 80 * third argument is single argument for printf;
81 * OSF1 use 3 arguments too, but last one always must be zero (NULL). 81 * OSF1 use 3 arguments too, but last one always must be zero (NULL).
82 * MHD doesn't use '%' in thread names, so both form are used in same way. 82 * MHD doesn't use '%' in thread names, so both form are used in same way.
83 */ 83 */return ! pthread_setname_np (thread_id, thread_name, 0);
84 return ! pthread_setname_np (thread_id, thread_name, 0);
85#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */ 84#endif /* HAVE_PTHREAD_SETNAME_NP_NETBSD */
86} 85}
87 86
@@ -235,6 +234,7 @@ MHD_create_thread_ (MHD_thread_handle_ID_ *thread,
235#endif 234#endif
236} 235}
237 236
237
238#ifdef MHD_USE_THREAD_NAME_ 238#ifdef MHD_USE_THREAD_NAME_
239 239
240#ifndef MHD_USE_THREAD_ATTR_SETNAME 240#ifndef MHD_USE_THREAD_ATTR_SETNAME
@@ -276,6 +276,8 @@ named_thread_starter (void *data)
276 276
277 return thr_func (arg); 277 return thr_func (arg);
278} 278}
279
280
279#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ 281#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
280 282
281 283
@@ -308,8 +310,7 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
308 * third argument is single argument for printf; 310 * third argument is single argument for printf;
309 * OSF1 use 3 arguments too, but last one always must be zero (NULL). 311 * OSF1 use 3 arguments too, but last one always must be zero (NULL).
310 * MHD doesn't use '%' in thread names, so both form are used in same way. 312 * MHD doesn't use '%' in thread names, so both form are used in same way.
311 */ 313 */res = pthread_attr_setname_np (&attr,
312 res = pthread_attr_setname_np (&attr,
313 thread_name, 314 thread_name,
314 0); 315 0);
315#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI) 316#elif defined(HAVE_PTHREAD_ATTR_SETNAME_NP_IBMI)
@@ -318,7 +319,7 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
318#else 319#else
319#error No pthread_attr_setname_np() function. 320#error No pthread_attr_setname_np() function.
320#endif 321#endif
321 if ((res == 0) &&(0 != stack_size) ) 322 if ((res == 0) && (0 != stack_size) )
322 res = pthread_attr_setstacksize (&attr, 323 res = pthread_attr_setstacksize (&attr,
323 stack_size); 324 stack_size);
324 if (0 == res) 325 if (0 == res)
@@ -365,4 +366,5 @@ MHD_create_named_thread_ (MHD_thread_handle_ID_ *thread,
365#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */ 366#endif /* ! MHD_USE_THREAD_ATTR_SETNAME */
366} 367}
367 368
369
368#endif /* MHD_USE_THREAD_NAME_ */ 370#endif /* MHD_USE_THREAD_NAME_ */
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index 8b6a33ea..a7548ae3 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -1013,8 +1013,7 @@ post_process_multipart (struct MHD_PostProcessor *pp,
1013 * > generally be left blank, and implementations must ignore 1013 * > generally be left blank, and implementations must ignore
1014 * > anything that appears before the first boundary delimiter 1014 * > anything that appears before the first boundary delimiter
1015 * > line or after the last one. 1015 * > line or after the last one.
1016 */ 1016 */(void) find_boundary (pp,
1017 (void) find_boundary (pp,
1018 pp->boundary, 1017 pp->boundary,
1019 pp->blen, 1018 pp->blen,
1020 &ioff, 1019 &ioff,
@@ -1290,4 +1289,5 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
1290 return ret; 1289 return ret;
1291} 1290}
1292 1291
1292
1293/* end of postprocessor.c */ 1293/* end of postprocessor.c */
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 968fc8c9..5adfdfa9 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -541,6 +541,7 @@ free_callback (void *cls)
541 response->fd = -1; 541 response->fd = -1;
542} 542}
543 543
544
544#undef MHD_create_response_from_fd_at_offset 545#undef MHD_create_response_from_fd_at_offset
545 546
546/** 547/**
@@ -1195,6 +1196,8 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
1195 } 1196 }
1196 return response; 1197 return response;
1197} 1198}
1199
1200
1198#endif /* UPGRADE_SUPPORT */ 1201#endif /* UPGRADE_SUPPORT */
1199 1202
1200 1203
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c
index 846a43b7..908bbda2 100644
--- a/src/microhttpd/sha256.c
+++ b/src/microhttpd/sha256.c
@@ -62,6 +62,7 @@ MHD_SHA256_init (void *ctx_)
62 ctx->count = 0; 62 ctx->count = 0;
63} 63}
64 64
65
65/** 66/**
66 * Number of bytes in single SHA-256 word 67 * Number of bytes in single SHA-256 word
67 * used to process data 68 * used to process data
@@ -246,6 +247,7 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH],
246 H[7] += h; 247 H[7] += h;
247} 248}
248 249
250
249/** 251/**
250 * Process portion of bytes. 252 * Process portion of bytes.
251 * 253 *
diff --git a/src/microhttpd/test_helpers.h b/src/microhttpd/test_helpers.h
index d47f7168..993d0718 100644
--- a/src/microhttpd/test_helpers.h
+++ b/src/microhttpd/test_helpers.h
@@ -64,6 +64,7 @@ has_in_name (const char *prog_name, const char *marker)
64 return strstr (prog_name + name_pos, marker) != (char*) 0; 64 return strstr (prog_name + name_pos, marker) != (char*) 0;
65} 65}
66 66
67
67/** 68/**
68 * Check whether one of strings in array is equal to @a param. 69 * Check whether one of strings in array is equal to @a param.
69 * String @a argv[0] is ignored. 70 * String @a argv[0] is ignored.
@@ -83,7 +84,7 @@ has_param (int argc, char *const argv[], const char *param)
83 84
84 for (i = 1; i < argc; i++) 85 for (i = 1; i < argc; i++)
85 { 86 {
86 if (argv[i] &&(strcmp (argv[i], param) == 0) ) 87 if (argv[i] && (strcmp (argv[i], param) == 0) )
87 return ! 0; 88 return ! 0;
88 } 89 }
89 90
diff --git a/src/microhttpd/test_http_reasons.c b/src/microhttpd/test_http_reasons.c
index 4d0484ad..7c2c3efd 100644
--- a/src/microhttpd/test_http_reasons.c
+++ b/src/microhttpd/test_http_reasons.c
@@ -28,7 +28,8 @@
28#include "microhttpd.h" 28#include "microhttpd.h"
29#include "mhd_str.h" 29#include "mhd_str.h"
30 30
31static int expect_result (int code, const char*expected) 31static int
32expect_result (int code, const char*expected)
32{ 33{
33 const char*const reason = MHD_get_reason_phrase_for (code); 34 const char*const reason = MHD_get_reason_phrase_for (code);
34 if (MHD_str_equal_caseless_ (reason, expected)) 35 if (MHD_str_equal_caseless_ (reason, expected))
@@ -39,12 +40,16 @@ static int expect_result (int code, const char*expected)
39 return 1; 40 return 1;
40} 41}
41 42
42static int expect_absent (int code) 43
44static int
45expect_absent (int code)
43{ 46{
44 return expect_result (code, "unknown"); 47 return expect_result (code, "unknown");
45} 48}
46 49
47static int test_absent_codes (void) 50
51static int
52test_absent_codes (void)
48{ 53{
49 int errcount = 0; 54 int errcount = 0;
50 errcount += expect_absent (0); 55 errcount += expect_absent (0);
@@ -58,7 +63,9 @@ static int test_absent_codes (void)
58 return errcount; 63 return errcount;
59} 64}
60 65
61static int test_1xx (void) 66
67static int
68test_1xx (void)
62{ 69{
63 int errcount = 0; 70 int errcount = 0;
64 errcount += expect_result (MHD_HTTP_CONTINUE, "continue"); 71 errcount += expect_result (MHD_HTTP_CONTINUE, "continue");
@@ -68,7 +75,9 @@ static int test_1xx (void)
68 return errcount; 75 return errcount;
69} 76}
70 77
71static int test_2xx (void) 78
79static int
80test_2xx (void)
72{ 81{
73 int errcount = 0; 82 int errcount = 0;
74 errcount += expect_result (MHD_HTTP_OK, "ok"); 83 errcount += expect_result (MHD_HTTP_OK, "ok");
@@ -80,7 +89,9 @@ static int test_2xx (void)
80 return errcount; 89 return errcount;
81} 90}
82 91
83static int test_3xx (void) 92
93static int
94test_3xx (void)
84{ 95{
85 int errcount = 0; 96 int errcount = 0;
86 errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices"); 97 errcount += expect_result (MHD_HTTP_MULTIPLE_CHOICES, "multiple choices");
@@ -91,7 +102,9 @@ static int test_3xx (void)
91 return errcount; 102 return errcount;
92} 103}
93 104
94static int test_4xx (void) 105
106static int
107test_4xx (void)
95{ 108{
96 int errcount = 0; 109 int errcount = 0;
97 errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request"); 110 errcount += expect_result (MHD_HTTP_BAD_REQUEST, "bad request");
@@ -108,7 +121,9 @@ static int test_4xx (void)
108 return errcount; 121 return errcount;
109} 122}
110 123
111static int test_5xx (void) 124
125static int
126test_5xx (void)
112{ 127{
113 int errcount = 0; 128 int errcount = 0;
114 errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR, 129 errcount += expect_result (MHD_HTTP_INTERNAL_SERVER_ERROR,
@@ -123,7 +138,9 @@ static int test_5xx (void)
123 return errcount; 138 return errcount;
124} 139}
125 140
126int main (int argc, char *argv[]) 141
142int
143main (int argc, char *argv[])
127{ 144{
128 int errcount = 0; 145 int errcount = 0;
129 (void) argc; (void) argv; /* Unused. Silent compiler warning. */ 146 (void) argc; (void) argv; /* Unused. Silent compiler warning. */
diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c
index be033ae8..0c0825f1 100644
--- a/src/microhttpd/test_options.c
+++ b/src/microhttpd/test_options.c
@@ -56,6 +56,7 @@ ahc_echo (void *cls,
56 return 0; 56 return 0;
57} 57}
58 58
59
59static int 60static int
60test_wrap_loc (char *test_name, int (*test)(void)) 61test_wrap_loc (char *test_name, int (*test)(void))
61{ 62{
@@ -122,6 +123,7 @@ test_ip_addr_option ()
122 return 0; 123 return 0;
123} 124}
124 125
126
125/* setup a temporary transfer test file */ 127/* setup a temporary transfer test file */
126int 128int
127main (int argc, char *const *argv) 129main (int argc, char *const *argv)
diff --git a/src/microhttpd/test_postprocessor.c b/src/microhttpd/test_postprocessor.c
index e1a167e7..75b5ba33 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -82,6 +82,7 @@ mismatch (const char *a, const char *b)
82 return 0 != strcmp (a, b); 82 return 0 != strcmp (a, b);
83} 83}
84 84
85
85static int 86static int
86value_checker (void *cls, 87value_checker (void *cls,
87 enum MHD_ValueKind kind, 88 enum MHD_ValueKind kind,
@@ -347,8 +348,6 @@ test_empty_value (void)
347} 348}
348 349
349 350
350
351
352int 351int
353main (int argc, char *const *argv) 352main (int argc, char *const *argv)
354{ 353{
diff --git a/src/microhttpd/test_postprocessor_amp.c b/src/microhttpd/test_postprocessor_amp.c
index e2ea4a54..54936979 100644
--- a/src/microhttpd/test_postprocessor_amp.c
+++ b/src/microhttpd/test_postprocessor_amp.c
@@ -7,10 +7,11 @@
7 7
8uint64_t num_errors; 8uint64_t num_errors;
9 9
10int check_post (void *cls, enum MHD_ValueKind kind, const char*key, 10int
11 const char*filename, const char*content_type, 11check_post (void *cls, enum MHD_ValueKind kind, const char*key,
12 const char*content_encoding, const char*data, 12 const char*filename, const char*content_type,
13 uint64_t off, size_t size) 13 const char*content_encoding, const char*data,
14 uint64_t off, size_t size)
14{ 15{
15 (void) cls; (void) kind; (void) filename; (void) content_type; /* Unused. Silent compiler warning. */ 16 (void) cls; (void) kind; (void) filename; (void) content_type; /* Unused. Silent compiler warning. */
16 (void) content_encoding; (void) data; (void) off; (void) size; /* Unused. Silent compiler warning. */ 17 (void) content_encoding; (void) data; (void) off; (void) size; /* Unused. Silent compiler warning. */
diff --git a/src/microhttpd/test_postprocessor_large.c b/src/microhttpd/test_postprocessor_large.c
index 68e5f671..0e2a10d2 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -98,6 +98,7 @@ test_simple_large ()
98 return 0; 98 return 0;
99} 99}
100 100
101
101int 102int
102main (int argc, char *const *argv) 103main (int argc, char *const *argv)
103{ 104{
diff --git a/src/microhttpd/test_sha256.c b/src/microhttpd/test_sha256.c
index da6f6e1f..54cdf027 100644
--- a/src/microhttpd/test_sha256.c
+++ b/src/microhttpd/test_sha256.c
@@ -285,6 +285,7 @@ bin2hex (const uint8_t *bin,
285 *hex = 0; 285 *hex = 0;
286} 286}
287 287
288
288static int 289static int
289check_result (const char *test_name, 290check_result (const char *test_name,
290 unsigned int check_num, 291 unsigned int check_num,
@@ -365,6 +366,7 @@ test1_bin (void)
365 return num_failed; 366 return num_failed;
366} 367}
367 368
369
368/* Calculated SHA-256 as two iterations for whole data */ 370/* Calculated SHA-256 as two iterations for whole data */
369static int 371static int
370test2_str (void) 372test2_str (void)
diff --git a/src/microhttpd/test_shutdown_select.c b/src/microhttpd/test_shutdown_select.c
index ae88658d..121c38cc 100644
--- a/src/microhttpd/test_shutdown_select.c
+++ b/src/microhttpd/test_shutdown_select.c
@@ -255,6 +255,8 @@ poll_thread (void*data)
255 255
256 return (MHD_THRD_RTRN_TYPE_) 0; 256 return (MHD_THRD_RTRN_TYPE_) 0;
257} 257}
258
259
258#endif /* HAVE_POLL */ 260#endif /* HAVE_POLL */
259 261
260 262
@@ -306,7 +308,7 @@ main (int argc, char *const *argv)
306 ver_req = MAKEWORD (2, 2); 308 ver_req = MAKEWORD (2, 2);
307 309
308 err = WSAStartup (ver_req, &wsa_data); 310 err = WSAStartup (ver_req, &wsa_data);
309 if ((err != 0)||(MAKEWORD (2, 2) != wsa_data.wVersion)) 311 if ((err != 0) || (MAKEWORD (2, 2) != wsa_data.wVersion))
310 { 312 {
311 printf ("WSAStartup() failed\n"); 313 printf ("WSAStartup() failed\n");
312 WSACleanup (); 314 WSACleanup ();
@@ -370,7 +372,7 @@ main (int argc, char *const *argv)
370 /* fprintf (stdout, "Thread finished.\n"); */ 372 /* fprintf (stdout, "Thread finished.\n"); */
371 MHD_socket_close_chk_ (listen_socket); 373 MHD_socket_close_chk_ (listen_socket);
372 374
373 if ((start_t == (time_t) -1) ||(end_t == (time_t) -1) ) 375 if ((start_t == (time_t) -1) || (end_t == (time_t) -1) )
374 { 376 {
375 MHD_socket_close_chk_ (listen_socket); 377 MHD_socket_close_chk_ (listen_socket);
376 fprintf (stderr, "Can't get current time\n"); 378 fprintf (stderr, "Can't get current time\n");
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c
index 541cc5c5..c2f1781b 100644
--- a/src/microhttpd/test_start_stop.c
+++ b/src/microhttpd/test_start_stop.c
@@ -67,6 +67,7 @@ testInternalGet (int poll_flag)
67 return 0; 67 return 0;
68} 68}
69 69
70
70static int 71static int
71testMultithreadedGet (int poll_flag) 72testMultithreadedGet (int poll_flag)
72{ 73{
@@ -97,6 +98,8 @@ testMultithreadedPoolGet (int poll_flag)
97 MHD_stop_daemon (d); 98 MHD_stop_daemon (d);
98 return 0; 99 return 0;
99} 100}
101
102
100#endif 103#endif
101 104
102 105
diff --git a/src/microhttpd/test_str.c b/src/microhttpd/test_str.c
index 8739a23a..a2f357b4 100644
--- a/src/microhttpd/test_str.c
+++ b/src/microhttpd/test_str.c
@@ -208,7 +208,8 @@ static const unsigned int locale_name_count = sizeof(locale_names)
208 * Helper functions 208 * Helper functions
209 */ 209 */
210 210
211int set_test_locale (unsigned int num) 211int
212set_test_locale (unsigned int num)
212{ 213{
213 if (num >= locale_name_count) 214 if (num >= locale_name_count)
214 return -1; 215 return -1;
@@ -225,17 +226,21 @@ int set_test_locale (unsigned int num)
225 return 0; 226 return 0;
226} 227}
227 228
228const char *get_current_locale_str (void) 229
230const char *
231get_current_locale_str (void)
229{ 232{
230 char const *loc_str = setlocale (LC_ALL, NULL); 233 char const *loc_str = setlocale (LC_ALL, NULL);
231 return loc_str ? loc_str : "unknown"; 234 return loc_str ? loc_str : "unknown";
232} 235}
233 236
237
234static char tmp_bufs[4][4 * 1024]; /* should be enough for testing */ 238static char tmp_bufs[4][4 * 1024]; /* should be enough for testing */
235static size_t buf_idx = 0; 239static size_t buf_idx = 0;
236 240
237/* print non-printable chars as char codes */ 241/* print non-printable chars as char codes */
238char *n_prnt (const char *str) 242char *
243n_prnt (const char *str)
239{ 244{
240 static char *buf; /* should be enough for testing */ 245 static char *buf; /* should be enough for testing */
241 static const size_t buf_size = sizeof(tmp_bufs[0]); 246 static const size_t buf_size = sizeof(tmp_bufs[0]);
@@ -248,14 +253,14 @@ char *n_prnt (const char *str)
248 while (*p && w_pos + 1 < buf_size) 253 while (*p && w_pos + 1 < buf_size)
249 { 254 {
250 const unsigned char c = *p; 255 const unsigned char c = *p;
251 if ((c == '\\') ||(c == '"') ) 256 if ((c == '\\') || (c == '"') )
252 { 257 {
253 if (w_pos + 2 >= buf_size) 258 if (w_pos + 2 >= buf_size)
254 break; 259 break;
255 buf[w_pos++] = '\\'; 260 buf[w_pos++] = '\\';
256 buf[w_pos++] = c; 261 buf[w_pos++] = c;
257 } 262 }
258 else if ((c >= 0x20) &&(c <= 0x7E) ) 263 else if ((c >= 0x20) && (c <= 0x7E) )
259 buf[w_pos++] = c; 264 buf[w_pos++] = c;
260 else 265 else
261 { 266 {
@@ -497,7 +502,8 @@ static const struct two_neq_strs neq_strings[] = {
497}; 502};
498 503
499 504
500int check_eq_strings (void) 505int
506check_eq_strings (void)
501{ 507{
502 size_t t_failed = 0; 508 size_t t_failed = 0;
503 size_t i, j; 509 size_t i, j;
@@ -532,7 +538,7 @@ int check_eq_strings (void)
532 " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str), 538 " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str),
533 get_current_locale_str ()); 539 get_current_locale_str ());
534 } 540 }
535 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 541 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
536 printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") != 0 && \\\n" 542 printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") != 0 && \\\n"
537 " MHD_str_equal_caseless_(\"%s\", \"%s\") != 0\n", 543 " MHD_str_equal_caseless_(\"%s\", \"%s\") != 0\n",
538 n_prnt (t->s1.str), n_prnt (t->s2.str), 544 n_prnt (t->s1.str), n_prnt (t->s2.str),
@@ -542,7 +548,9 @@ int check_eq_strings (void)
542 return t_failed; 548 return t_failed;
543} 549}
544 550
545int check_neq_strings (void) 551
552int
553check_neq_strings (void)
546{ 554{
547 size_t t_failed = 0; 555 size_t t_failed = 0;
548 size_t i, j; 556 size_t i, j;
@@ -577,7 +585,7 @@ int check_neq_strings (void)
577 " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str), 585 " Locale: %s\n", n_prnt (t->s2.str), n_prnt (t->s1.str),
578 get_current_locale_str ()); 586 get_current_locale_str ());
579 } 587 }
580 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 588 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
581 printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") == 0 && \\\n" 589 printf ("PASSED: MHD_str_equal_caseless_(\"%s\", \"%s\") == 0 && \\\n"
582 " MHD_str_equal_caseless_(\"%s\", \"%s\") == 0\n", 590 " MHD_str_equal_caseless_(\"%s\", \"%s\") == 0\n",
583 n_prnt (t->s1.str), n_prnt (t->s2.str), 591 n_prnt (t->s1.str), n_prnt (t->s2.str),
@@ -587,7 +595,9 @@ int check_neq_strings (void)
587 return t_failed; 595 return t_failed;
588} 596}
589 597
590int check_eq_strings_n (void) 598
599int
600check_eq_strings_n (void)
591{ 601{
592 size_t t_failed = 0; 602 size_t t_failed = 0;
593 size_t i, j, k; 603 size_t i, j, k;
@@ -627,7 +637,7 @@ int check_eq_strings_n (void)
627 get_current_locale_str ()); 637 get_current_locale_str ());
628 } 638 }
629 } 639 }
630 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 640 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
631 printf ( 641 printf (
632 "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" 642 "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n"
633 " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n", 643 " MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0, where N is 0..%u\n",
@@ -638,7 +648,9 @@ int check_eq_strings_n (void)
638 return t_failed; 648 return t_failed;
639} 649}
640 650
641int check_neq_strings_n (void) 651
652int
653check_neq_strings_n (void)
642{ 654{
643 size_t t_failed = 0; 655 size_t t_failed = 0;
644 size_t i, j, k; 656 size_t i, j, k;
@@ -732,7 +744,7 @@ int check_neq_strings_n (void)
732 } 744 }
733 } 745 }
734 } 746 }
735 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 747 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
736 { 748 {
737 printf ( 749 printf (
738 "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n" 750 "PASSED: MHD_str_equal_caseless_n_(\"%s\", \"%s\", N) != 0 && \\\n"
@@ -753,10 +765,12 @@ int check_neq_strings_n (void)
753 return t_failed; 765 return t_failed;
754} 766}
755 767
768
756/* 769/*
757 * Run eq/neq strings tests 770 * Run eq/neq strings tests
758 */ 771 */
759int run_eq_neq_str_tests (void) 772int
773run_eq_neq_str_tests (void)
760{ 774{
761 int str_equal_caseless_fails = 0; 775 int str_equal_caseless_fails = 0;
762 int str_equal_caseless_n_fails = 0; 776 int str_equal_caseless_n_fails = 0;
@@ -851,6 +865,7 @@ int run_eq_neq_str_tests (void)
851 return 0; 865 return 0;
852} 866}
853 867
868
854/* 869/*
855 * Digits in string -> value tests 870 * Digits in string -> value tests
856 */ 871 */
@@ -1118,7 +1133,8 @@ const struct str_with_len strx_ovflw[] = {
1118}; 1133};
1119 1134
1120 1135
1121int check_str_to_uint64_valid (void) 1136int
1137check_str_to_uint64_valid (void)
1122{ 1138{
1123 size_t t_failed = 0; 1139 size_t t_failed = 0;
1124 size_t i, j; 1140 size_t i, j;
@@ -1175,7 +1191,7 @@ int check_str_to_uint64_valid (void)
1175 t->str.str), rv, rv, 1191 t->str.str), rv, rv,
1176 t->val, get_current_locale_str ()); 1192 t->val, get_current_locale_str ());
1177 } 1193 }
1178 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1194 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1179 printf ( 1195 printf (
1180 "PASSED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") == %" PRIuPTR "\n", 1196 "PASSED: MHD_str_to_uint64_(\"%s\", ->%" PRIu64 ") == %" PRIuPTR "\n",
1181 n_prnt (t->str.str), rv, rs); 1197 n_prnt (t->str.str), rv, rs);
@@ -1185,7 +1201,8 @@ int check_str_to_uint64_valid (void)
1185} 1201}
1186 1202
1187 1203
1188int check_str_to_uint64_all_chars (void) 1204int
1205check_str_to_uint64_all_chars (void)
1189{ 1206{
1190 static const size_t n_checks = 256; /* from 0 to 255 */ 1207 static const size_t n_checks = 256; /* from 0 to 255 */
1191 int c_failed[n_checks]; 1208 int c_failed[n_checks];
@@ -1204,9 +1221,9 @@ int check_str_to_uint64_all_chars (void)
1204 { 1221 {
1205 static const uint64_t rnd_val = 24941852; 1222 static const uint64_t rnd_val = 24941852;
1206 size_t rs; 1223 size_t rs;
1207 if ((c >= '0') &&(c <= '9') ) 1224 if ((c >= '0') && (c <= '9') )
1208 continue; /* skip digits */ 1225 continue; /* skip digits */
1209 for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += 1226 for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val +=
1210 rnd_val) 1227 rnd_val)
1211 { 1228 {
1212 char test_str[] = "0123"; 1229 char test_str[] = "0123";
@@ -1236,7 +1253,7 @@ int check_str_to_uint64_all_chars (void)
1236 n_prnt (test_str), test_val, rv, get_current_locale_str ()); 1253 n_prnt (test_str), test_val, rv, get_current_locale_str ());
1237 } 1254 }
1238 } 1255 }
1239 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) 1256 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c])
1240 { 1257 {
1241 char test_str[] = "0123"; 1258 char test_str[] = "0123";
1242 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ 1259 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */
@@ -1251,7 +1268,8 @@ int check_str_to_uint64_all_chars (void)
1251} 1268}
1252 1269
1253 1270
1254int check_str_to_uint64_overflow (void) 1271int
1272check_str_to_uint64_overflow (void)
1255{ 1273{
1256 size_t t_failed = 0; 1274 size_t t_failed = 0;
1257 size_t i, j; 1275 size_t i, j;
@@ -1298,7 +1316,7 @@ int check_str_to_uint64_overflow (void)
1298 n_prnt (t->str), test_val, rv, get_current_locale_str ()); 1316 n_prnt (t->str), test_val, rv, get_current_locale_str ());
1299 } 1317 }
1300 } 1318 }
1301 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1319 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1302 printf ( 1320 printf (
1303 "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", 1321 "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n",
1304 n_prnt (t->str)); 1322 n_prnt (t->str));
@@ -1308,7 +1326,8 @@ int check_str_to_uint64_overflow (void)
1308} 1326}
1309 1327
1310 1328
1311int check_str_to_uint64_no_val (void) 1329int
1330check_str_to_uint64_no_val (void)
1312{ 1331{
1313 size_t t_failed = 0; 1332 size_t t_failed = 0;
1314 size_t i, j; 1333 size_t i, j;
@@ -1355,7 +1374,7 @@ int check_str_to_uint64_no_val (void)
1355 n_prnt (t->str), test_val, rv, get_current_locale_str ()); 1374 n_prnt (t->str), test_val, rv, get_current_locale_str ());
1356 } 1375 }
1357 } 1376 }
1358 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1377 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1359 printf ( 1378 printf (
1360 "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", 1379 "PASSED: MHD_str_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n",
1361 n_prnt (t->str)); 1380 n_prnt (t->str));
@@ -1365,7 +1384,8 @@ int check_str_to_uint64_no_val (void)
1365} 1384}
1366 1385
1367 1386
1368int check_str_to_uint64_n_valid (void) 1387int
1388check_str_to_uint64_n_valid (void)
1369{ 1389{
1370 size_t t_failed = 0; 1390 size_t t_failed = 0;
1371 size_t i, j; 1391 size_t i, j;
@@ -1423,7 +1443,7 @@ int check_str_to_uint64_n_valid (void)
1423 t->val, get_current_locale_str ()); 1443 t->val, get_current_locale_str ());
1424 } 1444 }
1425 } 1445 }
1426 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1446 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1427 printf ( 1447 printf (
1428 "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->%" 1448 "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR ", ->%"
1429 PRIu64 ")" 1449 PRIu64 ")"
@@ -1436,7 +1456,8 @@ int check_str_to_uint64_n_valid (void)
1436} 1456}
1437 1457
1438 1458
1439int check_str_to_uint64_n_all_chars (void) 1459int
1460check_str_to_uint64_n_all_chars (void)
1440{ 1461{
1441 static const size_t n_checks = 256; /* from 0 to 255 */ 1462 static const size_t n_checks = 256; /* from 0 to 255 */
1442 int c_failed[n_checks]; 1463 int c_failed[n_checks];
@@ -1457,12 +1478,12 @@ int check_str_to_uint64_n_all_chars (void)
1457 size_t rs; 1478 size_t rs;
1458 size_t len; 1479 size_t len;
1459 1480
1460 if ((c >= '0') &&(c <= '9') ) 1481 if ((c >= '0') && (c <= '9') )
1461 continue; /* skip digits */ 1482 continue; /* skip digits */
1462 1483
1463 for (len = 0; len <= 5; len++) 1484 for (len = 0; len <= 5; len++)
1464 { 1485 {
1465 for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += 1486 for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val +=
1466 rnd_val) 1487 rnd_val)
1467 { 1488 {
1468 char test_str[] = "0123"; 1489 char test_str[] = "0123";
@@ -1497,7 +1518,7 @@ int check_str_to_uint64_n_all_chars (void)
1497 } 1518 }
1498 } 1519 }
1499 } 1520 }
1500 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) 1521 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c])
1501 { 1522 {
1502 char test_str[] = "0123"; 1523 char test_str[] = "0123";
1503 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ 1524 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */
@@ -1512,7 +1533,8 @@ int check_str_to_uint64_n_all_chars (void)
1512} 1533}
1513 1534
1514 1535
1515int check_str_to_uint64_n_overflow (void) 1536int
1537check_str_to_uint64_n_overflow (void)
1516{ 1538{
1517 size_t t_failed = 0; 1539 size_t t_failed = 0;
1518 size_t i, j; 1540 size_t i, j;
@@ -1567,7 +1589,7 @@ int check_str_to_uint64_n_overflow (void)
1567 } 1589 }
1568 } 1590 }
1569 } 1591 }
1570 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1592 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1571 printf ( 1593 printf (
1572 "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR 1594 "PASSED: MHD_str_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR
1573 ", &ret_val) == 0," 1595 ", &ret_val) == 0,"
@@ -1580,7 +1602,8 @@ int check_str_to_uint64_n_overflow (void)
1580} 1602}
1581 1603
1582 1604
1583int check_str_to_uint64_n_no_val (void) 1605int
1606check_str_to_uint64_n_no_val (void)
1584{ 1607{
1585 size_t t_failed = 0; 1608 size_t t_failed = 0;
1586 size_t i, j; 1609 size_t i, j;
@@ -1635,7 +1658,7 @@ int check_str_to_uint64_n_no_val (void)
1635 } 1658 }
1636 } 1659 }
1637 } 1660 }
1638 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1661 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1639 printf ( 1662 printf (
1640 "PASSED: MHD_str_to_uint64_n_(\"%s\", 0..%" PRIuPTR 1663 "PASSED: MHD_str_to_uint64_n_(\"%s\", 0..%" PRIuPTR
1641 ", &ret_val) == 0," 1664 ", &ret_val) == 0,"
@@ -1647,7 +1670,8 @@ int check_str_to_uint64_n_no_val (void)
1647} 1670}
1648 1671
1649 1672
1650int check_strx_to_uint32_valid (void) 1673int
1674check_strx_to_uint32_valid (void)
1651{ 1675{
1652 size_t t_failed = 0; 1676 size_t t_failed = 0;
1653 size_t i, j; 1677 size_t i, j;
@@ -1708,7 +1732,7 @@ int check_strx_to_uint32_valid (void)
1708 t->str.str), (uint64_t) rv, (uint64_t) rv, 1732 t->str.str), (uint64_t) rv, (uint64_t) rv,
1709 t->val, get_current_locale_str ()); 1733 t->val, get_current_locale_str ());
1710 } 1734 }
1711 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1735 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1712 printf ( 1736 printf (
1713 "PASSED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR 1737 "PASSED: MHD_strx_to_uint32_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR
1714 "\n", 1738 "\n",
@@ -1719,7 +1743,8 @@ int check_strx_to_uint32_valid (void)
1719} 1743}
1720 1744
1721 1745
1722int check_strx_to_uint32_all_chars (void) 1746int
1747check_strx_to_uint32_all_chars (void)
1723{ 1748{
1724 static const size_t n_checks = 256; /* from 0 to 255 */ 1749 static const size_t n_checks = 256; /* from 0 to 255 */
1725 int c_failed[n_checks]; 1750 int c_failed[n_checks];
@@ -1738,12 +1763,13 @@ int check_strx_to_uint32_all_chars (void)
1738 { 1763 {
1739 static const uint32_t rnd_val = 234234; 1764 static const uint32_t rnd_val = 234234;
1740 size_t rs; 1765 size_t rs;
1741 if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) ||((c >= 1766 if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >=
1742 'a') && 1767 'a')
1743 (c <= 1768 &&
1744 'f') )) 1769 (c <=
1770 'f') ))
1745 continue; /* skip xdigits */ 1771 continue; /* skip xdigits */
1746 for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += 1772 for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val +=
1747 rnd_val) 1773 rnd_val)
1748 { 1774 {
1749 char test_str[] = "0123"; 1775 char test_str[] = "0123";
@@ -1774,7 +1800,7 @@ int check_strx_to_uint32_all_chars (void)
1774 get_current_locale_str ()); 1800 get_current_locale_str ());
1775 } 1801 }
1776 } 1802 }
1777 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) 1803 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c])
1778 { 1804 {
1779 char test_str[] = "0123"; 1805 char test_str[] = "0123";
1780 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ 1806 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */
@@ -1789,7 +1815,8 @@ int check_strx_to_uint32_all_chars (void)
1789} 1815}
1790 1816
1791 1817
1792int check_strx_to_uint32_overflow (void) 1818int
1819check_strx_to_uint32_overflow (void)
1793{ 1820{
1794 size_t t_failed = 0; 1821 size_t t_failed = 0;
1795 size_t i, j; 1822 size_t i, j;
@@ -1854,7 +1881,7 @@ int check_strx_to_uint32_overflow (void)
1854 get_current_locale_str ()); 1881 get_current_locale_str ());
1855 } 1882 }
1856 } 1883 }
1857 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1884 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1858 printf ( 1885 printf (
1859 "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", 1886 "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n",
1860 n_prnt (str)); 1887 n_prnt (str));
@@ -1864,7 +1891,8 @@ int check_strx_to_uint32_overflow (void)
1864} 1891}
1865 1892
1866 1893
1867int check_strx_to_uint32_no_val (void) 1894int
1895check_strx_to_uint32_no_val (void)
1868{ 1896{
1869 size_t t_failed = 0; 1897 size_t t_failed = 0;
1870 size_t i, j; 1898 size_t i, j;
@@ -1912,7 +1940,7 @@ int check_strx_to_uint32_no_val (void)
1912 get_current_locale_str ()); 1940 get_current_locale_str ());
1913 } 1941 }
1914 } 1942 }
1915 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 1943 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1916 printf ( 1944 printf (
1917 "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", 1945 "PASSED: MHD_strx_to_uint32_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n",
1918 n_prnt (t->str)); 1946 n_prnt (t->str));
@@ -1922,7 +1950,8 @@ int check_strx_to_uint32_no_val (void)
1922} 1950}
1923 1951
1924 1952
1925int check_strx_to_uint32_n_valid (void) 1953int
1954check_strx_to_uint32_n_valid (void)
1926{ 1955{
1927 size_t t_failed = 0; 1956 size_t t_failed = 0;
1928 size_t i, j; 1957 size_t i, j;
@@ -1984,7 +2013,7 @@ int check_strx_to_uint32_n_valid (void)
1984 t->val, get_current_locale_str ()); 2013 t->val, get_current_locale_str ());
1985 } 2014 }
1986 } 2015 }
1987 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2016 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
1988 printf ( 2017 printf (
1989 "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR 2018 "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR
1990 ", ->0x%" 2019 ", ->0x%"
@@ -1998,7 +2027,8 @@ int check_strx_to_uint32_n_valid (void)
1998} 2027}
1999 2028
2000 2029
2001int check_strx_to_uint32_n_all_chars (void) 2030int
2031check_strx_to_uint32_n_all_chars (void)
2002{ 2032{
2003 static const size_t n_checks = 256; /* from 0 to 255 */ 2033 static const size_t n_checks = 256; /* from 0 to 255 */
2004 int c_failed[n_checks]; 2034 int c_failed[n_checks];
@@ -2019,15 +2049,16 @@ int check_strx_to_uint32_n_all_chars (void)
2019 size_t rs; 2049 size_t rs;
2020 size_t len; 2050 size_t len;
2021 2051
2022 if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) || ((c >= 2052 if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >=
2023 'a') && 2053 'a')
2024 (c <= 2054 &&
2025 'f') )) 2055 (c <=
2056 'f') ))
2026 continue; /* skip xdigits */ 2057 continue; /* skip xdigits */
2027 2058
2028 for (len = 0; len <= 5; len++) 2059 for (len = 0; len <= 5; len++)
2029 { 2060 {
2030 for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += 2061 for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val +=
2031 rnd_val) 2062 rnd_val)
2032 { 2063 {
2033 char test_str[] = "0123"; 2064 char test_str[] = "0123";
@@ -2063,7 +2094,7 @@ int check_strx_to_uint32_n_all_chars (void)
2063 } 2094 }
2064 } 2095 }
2065 } 2096 }
2066 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) 2097 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c])
2067 { 2098 {
2068 char test_str[] = "0123"; 2099 char test_str[] = "0123";
2069 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ 2100 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */
@@ -2078,7 +2109,8 @@ int check_strx_to_uint32_n_all_chars (void)
2078} 2109}
2079 2110
2080 2111
2081int check_strx_to_uint32_n_overflow (void) 2112int
2113check_strx_to_uint32_n_overflow (void)
2082{ 2114{
2083 size_t t_failed = 0; 2115 size_t t_failed = 0;
2084 size_t i, j; 2116 size_t i, j;
@@ -2166,7 +2198,7 @@ int check_strx_to_uint32_n_overflow (void)
2166 } 2198 }
2167 } 2199 }
2168 } 2200 }
2169 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2201 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2170 printf ( 2202 printf (
2171 "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR 2203 "PASSED: MHD_strx_to_uint32_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR
2172 ", &ret_val) == 0," 2204 ", &ret_val) == 0,"
@@ -2179,7 +2211,8 @@ int check_strx_to_uint32_n_overflow (void)
2179} 2211}
2180 2212
2181 2213
2182int check_strx_to_uint32_n_no_val (void) 2214int
2215check_strx_to_uint32_n_no_val (void)
2183{ 2216{
2184 size_t t_failed = 0; 2217 size_t t_failed = 0;
2185 size_t i, j; 2218 size_t i, j;
@@ -2235,7 +2268,7 @@ int check_strx_to_uint32_n_no_val (void)
2235 } 2268 }
2236 } 2269 }
2237 } 2270 }
2238 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2271 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2239 printf ( 2272 printf (
2240 "PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..%" PRIuPTR 2273 "PASSED: MHD_strx_to_uint32_n_(\"%s\", 0..%" PRIuPTR
2241 ", &ret_val) == 0," 2274 ", &ret_val) == 0,"
@@ -2247,7 +2280,8 @@ int check_strx_to_uint32_n_no_val (void)
2247} 2280}
2248 2281
2249 2282
2250int check_strx_to_uint64_valid (void) 2283int
2284check_strx_to_uint64_valid (void)
2251{ 2285{
2252 size_t t_failed = 0; 2286 size_t t_failed = 0;
2253 size_t i, j; 2287 size_t i, j;
@@ -2304,7 +2338,7 @@ int check_strx_to_uint64_valid (void)
2304 t->str.str), rv, rv, 2338 t->str.str), rv, rv,
2305 t->val, get_current_locale_str ()); 2339 t->val, get_current_locale_str ());
2306 } 2340 }
2307 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2341 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2308 printf ( 2342 printf (
2309 "PASSED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR 2343 "PASSED: MHD_strx_to_uint64_(\"%s\", ->0x%" PRIX64 ") == %" PRIuPTR
2310 "\n", 2344 "\n",
@@ -2315,7 +2349,8 @@ int check_strx_to_uint64_valid (void)
2315} 2349}
2316 2350
2317 2351
2318int check_strx_to_uint64_all_chars (void) 2352int
2353check_strx_to_uint64_all_chars (void)
2319{ 2354{
2320 static const size_t n_checks = 256; /* from 0 to 255 */ 2355 static const size_t n_checks = 256; /* from 0 to 255 */
2321 int c_failed[n_checks]; 2356 int c_failed[n_checks];
@@ -2334,12 +2369,13 @@ int check_strx_to_uint64_all_chars (void)
2334 { 2369 {
2335 static const uint64_t rnd_val = 234234; 2370 static const uint64_t rnd_val = 234234;
2336 size_t rs; 2371 size_t rs;
2337 if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) || ((c >= 2372 if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >=
2338 'a') && 2373 'a')
2339 (c <= 2374 &&
2340 'f') )) 2375 (c <=
2376 'f') ))
2341 continue; /* skip xdigits */ 2377 continue; /* skip xdigits */
2342 for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += 2378 for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val +=
2343 rnd_val) 2379 rnd_val)
2344 { 2380 {
2345 char test_str[] = "0123"; 2381 char test_str[] = "0123";
@@ -2369,7 +2405,7 @@ int check_strx_to_uint64_all_chars (void)
2369 n_prnt (test_str), test_val, rv, get_current_locale_str ()); 2405 n_prnt (test_str), test_val, rv, get_current_locale_str ());
2370 } 2406 }
2371 } 2407 }
2372 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) 2408 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c])
2373 { 2409 {
2374 char test_str[] = "0123"; 2410 char test_str[] = "0123";
2375 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ 2411 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */
@@ -2384,7 +2420,8 @@ int check_strx_to_uint64_all_chars (void)
2384} 2420}
2385 2421
2386 2422
2387int check_strx_to_uint64_overflow (void) 2423int
2424check_strx_to_uint64_overflow (void)
2388{ 2425{
2389 size_t t_failed = 0; 2426 size_t t_failed = 0;
2390 size_t i, j; 2427 size_t i, j;
@@ -2431,7 +2468,7 @@ int check_strx_to_uint64_overflow (void)
2431 n_prnt (t->str), test_val, rv, get_current_locale_str ()); 2468 n_prnt (t->str), test_val, rv, get_current_locale_str ());
2432 } 2469 }
2433 } 2470 }
2434 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2471 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2435 printf ( 2472 printf (
2436 "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", 2473 "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n",
2437 n_prnt (t->str)); 2474 n_prnt (t->str));
@@ -2441,7 +2478,8 @@ int check_strx_to_uint64_overflow (void)
2441} 2478}
2442 2479
2443 2480
2444int check_strx_to_uint64_no_val (void) 2481int
2482check_strx_to_uint64_no_val (void)
2445{ 2483{
2446 size_t t_failed = 0; 2484 size_t t_failed = 0;
2447 size_t i, j; 2485 size_t i, j;
@@ -2488,7 +2526,7 @@ int check_strx_to_uint64_no_val (void)
2488 n_prnt (t->str), test_val, rv, get_current_locale_str ()); 2526 n_prnt (t->str), test_val, rv, get_current_locale_str ());
2489 } 2527 }
2490 } 2528 }
2491 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2529 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2492 printf ( 2530 printf (
2493 "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n", 2531 "PASSED: MHD_strx_to_uint64_(\"%s\", &ret_val) == 0, value of ret_val is unmodified\n",
2494 n_prnt (t->str)); 2532 n_prnt (t->str));
@@ -2498,7 +2536,8 @@ int check_strx_to_uint64_no_val (void)
2498} 2536}
2499 2537
2500 2538
2501int check_strx_to_uint64_n_valid (void) 2539int
2540check_strx_to_uint64_n_valid (void)
2502{ 2541{
2503 size_t t_failed = 0; 2542 size_t t_failed = 0;
2504 size_t i, j; 2543 size_t i, j;
@@ -2556,7 +2595,7 @@ int check_strx_to_uint64_n_valid (void)
2556 t->val, get_current_locale_str ()); 2595 t->val, get_current_locale_str ());
2557 } 2596 }
2558 } 2597 }
2559 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2598 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2560 printf ( 2599 printf (
2561 "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR 2600 "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR
2562 ", ->0x%" 2601 ", ->0x%"
@@ -2570,7 +2609,8 @@ int check_strx_to_uint64_n_valid (void)
2570} 2609}
2571 2610
2572 2611
2573int check_strx_to_uint64_n_all_chars (void) 2612int
2613check_strx_to_uint64_n_all_chars (void)
2574{ 2614{
2575 static const size_t n_checks = 256; /* from 0 to 255 */ 2615 static const size_t n_checks = 256; /* from 0 to 255 */
2576 int c_failed[n_checks]; 2616 int c_failed[n_checks];
@@ -2591,15 +2631,16 @@ int check_strx_to_uint64_n_all_chars (void)
2591 size_t rs; 2631 size_t rs;
2592 size_t len; 2632 size_t len;
2593 2633
2594 if (((c >= '0') &&(c <= '9') ) || ((c >= 'A') &&(c <= 'F') ) || ((c >= 2634 if (((c >= '0') && (c <= '9') ) || ((c >= 'A') && (c <= 'F') ) || ((c >=
2595 'a') && 2635 'a')
2596 (c <= 2636 &&
2597 'f') )) 2637 (c <=
2638 'f') ))
2598 continue; /* skip xdigits */ 2639 continue; /* skip xdigits */
2599 2640
2600 for (len = 0; len <= 5; len++) 2641 for (len = 0; len <= 5; len++)
2601 { 2642 {
2602 for (test_val = 0; test_val <= rnd_val&& ! c_failed[c]; test_val += 2643 for (test_val = 0; test_val <= rnd_val && ! c_failed[c]; test_val +=
2603 rnd_val) 2644 rnd_val)
2604 { 2645 {
2605 char test_str[] = "0123"; 2646 char test_str[] = "0123";
@@ -2635,7 +2676,7 @@ int check_strx_to_uint64_n_all_chars (void)
2635 } 2676 }
2636 } 2677 }
2637 } 2678 }
2638 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[c]) 2679 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[c])
2639 { 2680 {
2640 char test_str[] = "0123"; 2681 char test_str[] = "0123";
2641 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */ 2682 test_str[0] = (char) (unsigned char) c; /* replace first char with non-digit char */
@@ -2650,7 +2691,8 @@ int check_strx_to_uint64_n_all_chars (void)
2650} 2691}
2651 2692
2652 2693
2653int check_strx_to_uint64_n_overflow (void) 2694int
2695check_strx_to_uint64_n_overflow (void)
2654{ 2696{
2655 size_t t_failed = 0; 2697 size_t t_failed = 0;
2656 size_t i, j; 2698 size_t i, j;
@@ -2706,7 +2748,7 @@ int check_strx_to_uint64_n_overflow (void)
2706 } 2748 }
2707 } 2749 }
2708 } 2750 }
2709 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2751 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2710 printf ( 2752 printf (
2711 "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR 2753 "PASSED: MHD_strx_to_uint64_n_(\"%s\", %" PRIuPTR "..%" PRIuPTR
2712 ", &ret_val) == 0," 2754 ", &ret_val) == 0,"
@@ -2719,7 +2761,8 @@ int check_strx_to_uint64_n_overflow (void)
2719} 2761}
2720 2762
2721 2763
2722int check_strx_to_uint64_n_no_val (void) 2764int
2765check_strx_to_uint64_n_no_val (void)
2723{ 2766{
2724 size_t t_failed = 0; 2767 size_t t_failed = 0;
2725 size_t i, j; 2768 size_t i, j;
@@ -2775,7 +2818,7 @@ int check_strx_to_uint64_n_no_val (void)
2775 } 2818 }
2776 } 2819 }
2777 } 2820 }
2778 if ((verbose > 1) &&(j == locale_name_count - 1) && ! c_failed[i]) 2821 if ((verbose > 1) && (j == locale_name_count - 1) && ! c_failed[i])
2779 printf ( 2822 printf (
2780 "PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..%" PRIuPTR 2823 "PASSED: MHD_strx_to_uint64_n_(\"%s\", 0..%" PRIuPTR
2781 ", &ret_val) == 0," 2824 ", &ret_val) == 0,"
@@ -2787,7 +2830,8 @@ int check_strx_to_uint64_n_no_val (void)
2787} 2830}
2788 2831
2789 2832
2790int run_str_to_X_tests (void) 2833int
2834run_str_to_X_tests (void)
2791{ 2835{
2792 int str_to_uint64_fails = 0; 2836 int str_to_uint64_fails = 0;
2793 int str_to_uint64_n_fails = 0; 2837 int str_to_uint64_n_fails = 0;
@@ -3270,7 +3314,8 @@ int run_str_to_X_tests (void)
3270} 3314}
3271 3315
3272 3316
3273int main (int argc, char *argv[]) 3317int
3318main (int argc, char *argv[])
3274{ 3319{
3275 if (has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose") || 3320 if (has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose") ||
3276 has_param (argc, argv, "--verbose1")) 3321 has_param (argc, argv, "--verbose1"))
diff --git a/src/microhttpd/test_str_token.c b/src/microhttpd/test_str_token.c
index 0baca53d..1e1eab28 100644
--- a/src/microhttpd/test_str_token.c
+++ b/src/microhttpd/test_str_token.c
@@ -41,6 +41,7 @@ expect_found_n (const char *str, const char *token, size_t token_len)
41 return 0; 41 return 0;
42} 42}
43 43
44
44#define expect_found(s,t) expect_found_n ((s),(t),MHD_STATICSTR_LEN_ (t)) 45#define expect_found(s,t) expect_found_n ((s),(t),MHD_STATICSTR_LEN_ (t))
45 46
46static int 47static int
@@ -56,10 +57,12 @@ expect_not_found_n (const char *str, const char *token, size_t token_len)
56 return 0; 57 return 0;
57} 58}
58 59
60
59#define expect_not_found(s,t) expect_not_found_n ((s),(t),MHD_STATICSTR_LEN_ ( \ 61#define expect_not_found(s,t) expect_not_found_n ((s),(t),MHD_STATICSTR_LEN_ ( \
60 t)) 62 t))
61 63
62int check_match (void) 64int
65check_match (void)
63{ 66{
64 int errcount = 0; 67 int errcount = 0;
65 errcount += expect_found ("string", "string"); 68 errcount += expect_found ("string", "string");
@@ -85,7 +88,9 @@ int check_match (void)
85 return errcount; 88 return errcount;
86} 89}
87 90
88int check_not_match (void) 91
92int
93check_not_match (void)
89{ 94{
90 int errcount = 0; 95 int errcount = 0;
91 errcount += expect_not_found ("strin", "string"); 96 errcount += expect_not_found ("strin", "string");
@@ -111,7 +116,9 @@ int check_not_match (void)
111 return errcount; 116 return errcount;
112} 117}
113 118
114int main (int argc, char *argv[]) 119
120int
121main (int argc, char *argv[])
115{ 122{
116 int errcount = 0; 123 int errcount = 0;
117 (void) argc; (void) argv; /* Unused. Silent compiler warning. */ 124 (void) argc; (void) argv; /* Unused. Silent compiler warning. */
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index dbfa847d..404c2854 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -139,6 +139,8 @@ gnutlscli_connect (int *sock,
139 } 139 }
140 _exit (1); 140 _exit (1);
141} 141}
142
143
142#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ 144#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
143 145
144 146
@@ -296,14 +298,14 @@ wr_connect (struct wr_socket *s,
296 * it require processing on MHD side and 298 * it require processing on MHD side and
297 * when testing with "external" polling, 299 * when testing with "external" polling,
298 * test will call MHD processing only 300 * test will call MHD processing only
299 * after return from wr_connect(). */ 301 * after return from wr_connect(). */s->tls_connected = 0;
300 s->tls_connected = 0;
301 return 0; 302 return 0;
302 } 303 }
303#endif /* HTTPS_SUPPORT */ 304#endif /* HTTPS_SUPPORT */
304 return -1; 305 return -1;
305} 306}
306 307
308
307#ifdef HTTPS_SUPPORT 309#ifdef HTTPS_SUPPORT
308/* Only to be called from wr_send() and wr_recv() ! */ 310/* Only to be called from wr_send() and wr_recv() ! */
309static bool 311static bool
@@ -318,6 +320,8 @@ wr_handshake (struct wr_socket *s)
318 MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ 320 MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */
319 return s->tls_connected; 321 return s->tls_connected;
320} 322}
323
324
321#endif /* HTTPS_SUPPORT */ 325#endif /* HTTPS_SUPPORT */
322 326
323 327
@@ -924,6 +928,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
924 } 928 }
925} 929}
926 930
931
927#ifdef HAVE_POLL 932#ifdef HAVE_POLL
928 933
929/** 934/**
@@ -937,6 +942,8 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon)
937 (void) daemon; /* Unused. Silent compiler warning. */ 942 (void) daemon; /* Unused. Silent compiler warning. */
938 abort (); /* currently not implementable with existing MHD API */ 943 abort (); /* currently not implementable with existing MHD API */
939} 944}
945
946
940#endif /* HAVE_POLL */ 947#endif /* HAVE_POLL */
941 948
942 949
@@ -983,6 +990,8 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
983 MHD_run (daemon); 990 MHD_run (daemon);
984 } 991 }
985} 992}
993
994
986#endif /* EPOLL_SUPPORT */ 995#endif /* EPOLL_SUPPORT */
987 996
988/** 997/**
@@ -1076,7 +1085,7 @@ test_upgrade (int flags,
1076 if ( (NULL == dinfo) || 1085 if ( (NULL == dinfo) ||
1077 (0 == dinfo->port) ) 1086 (0 == dinfo->port) )
1078 abort (); 1087 abort ();
1079 if (! test_tls ||(TLS_LIB_GNUTLS == use_tls_tool)) 1088 if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool))
1080 { 1089 {
1081 sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); 1090 sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
1082 if (NULL == sock) 1091 if (NULL == sock)
@@ -1134,7 +1143,7 @@ test_upgrade (int flags,
1134 pthread_join (pt, 1143 pthread_join (pt,
1135 NULL); 1144 NULL);
1136#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) 1145#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID)
1137 if (test_tls &&(TLS_LIB_GNUTLS != use_tls_tool)) 1146 if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool))
1138 waitpid (pid, NULL, 0); 1147 waitpid (pid, NULL, 0);
1139#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ 1148#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
1140 MHD_stop_daemon (d); 1149 MHD_stop_daemon (d);
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c
index 9ad15578..a17293db 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -149,6 +149,8 @@ gnutlscli_connect (int *sock,
149 } 149 }
150 _exit (1); 150 _exit (1);
151} 151}
152
153
152#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ 154#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
153 155
154 156
@@ -306,14 +308,14 @@ wr_connect (struct wr_socket *s,
306 * it require processing on MHD side and 308 * it require processing on MHD side and
307 * when testing with "external" polling, 309 * when testing with "external" polling,
308 * test will call MHD processing only 310 * test will call MHD processing only
309 * after return from wr_connect(). */ 311 * after return from wr_connect(). */s->tls_connected = 0;
310 s->tls_connected = 0;
311 return 0; 312 return 0;
312 } 313 }
313#endif /* HTTPS_SUPPORT */ 314#endif /* HTTPS_SUPPORT */
314 return -1; 315 return -1;
315} 316}
316 317
318
317#ifdef HTTPS_SUPPORT 319#ifdef HTTPS_SUPPORT
318/* Only to be called from wr_send() and wr_recv() ! */ 320/* Only to be called from wr_send() and wr_recv() ! */
319static bool 321static bool
@@ -328,6 +330,8 @@ wr_handshake (struct wr_socket *s)
328 MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */ 330 MHD_socket_set_error_ (MHD_SCKT_ECONNABORTED_); /* hard error */
329 return s->tls_connected; 331 return s->tls_connected;
330} 332}
333
334
331#endif /* HTTPS_SUPPORT */ 335#endif /* HTTPS_SUPPORT */
332 336
333 337
@@ -958,6 +962,7 @@ run_mhd_select_loop (struct MHD_Daemon *daemon)
958 kicker[1] = -1; 962 kicker[1] = -1;
959} 963}
960 964
965
961#ifdef HAVE_POLL 966#ifdef HAVE_POLL
962 967
963/** 968/**
@@ -971,6 +976,8 @@ run_mhd_poll_loop (struct MHD_Daemon *daemon)
971 (void) daemon; /* Unused. Silent compiler warning. */ 976 (void) daemon; /* Unused. Silent compiler warning. */
972 abort (); /* currently not implementable with existing MHD API */ 977 abort (); /* currently not implementable with existing MHD API */
973} 978}
979
980
974#endif /* HAVE_POLL */ 981#endif /* HAVE_POLL */
975 982
976 983
@@ -1026,6 +1033,8 @@ run_mhd_epoll_loop (struct MHD_Daemon *daemon)
1026 kicker[0] = -1; 1033 kicker[0] = -1;
1027 kicker[1] = -1; 1034 kicker[1] = -1;
1028} 1035}
1036
1037
1029#endif /* EPOLL_SUPPORT */ 1038#endif /* EPOLL_SUPPORT */
1030 1039
1031/** 1040/**
@@ -1121,7 +1130,7 @@ test_upgrade (int flags,
1121 if ( (NULL == dinfo) || 1130 if ( (NULL == dinfo) ||
1122 (0 == dinfo->port) ) 1131 (0 == dinfo->port) )
1123 abort (); 1132 abort ();
1124 if (! test_tls ||(TLS_LIB_GNUTLS == use_tls_tool)) 1133 if (! test_tls || (TLS_LIB_GNUTLS == use_tls_tool))
1125 { 1134 {
1126 sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt (); 1135 sock = test_tls ? wr_create_tls_sckt () : wr_create_plain_sckt ();
1127 if (NULL == sock) 1136 if (NULL == sock)
@@ -1179,7 +1188,7 @@ test_upgrade (int flags,
1179 pthread_join (pt, 1188 pthread_join (pt,
1180 NULL); 1189 NULL);
1181#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID) 1190#if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID)
1182 if (test_tls &&(TLS_LIB_GNUTLS != use_tls_tool)) 1191 if (test_tls && (TLS_LIB_GNUTLS != use_tls_tool))
1183 waitpid (pid, NULL, 0); 1192 waitpid (pid, NULL, 0);
1184#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */ 1193#endif /* HTTPS_SUPPORT && HAVE_FORK && HAVE_WAITPID */
1185 MHD_stop_daemon (d); 1194 MHD_stop_daemon (d);
diff --git a/src/microhttpd/tsearch.c b/src/microhttpd/tsearch.c
index e43d758f..78f37608 100644
--- a/src/microhttpd/tsearch.c
+++ b/src/microhttpd/tsearch.c
@@ -102,7 +102,7 @@ tdelete (const void *__restrict vkey,
102 node_t *r; 102 node_t *r;
103 int cmp; 103 int cmp;
104 104
105 if ((rootp == NULL)||((p = *rootp) == NULL)) 105 if ((rootp == NULL) || ((p = *rootp) == NULL))
106 return NULL; 106 return NULL;
107 107
108 while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0) 108 while ((cmp = (*compar)(vkey, (*rootp)->key)) != 0)
@@ -140,4 +140,5 @@ tdelete (const void *__restrict vkey,
140 return p; 140 return p;
141} 141}
142 142
143
143/* end of tsearch.c */ 144/* end of tsearch.c */
diff --git a/src/testcurl/curl_version_check.c b/src/testcurl/curl_version_check.c
index d1134f42..445c85d7 100644
--- a/src/testcurl/curl_version_check.c
+++ b/src/testcurl/curl_version_check.c
@@ -50,6 +50,7 @@ parse_version_number (const char **s)
50 return atoi (num); 50 return atoi (num);
51} 51}
52 52
53
53const char * 54const char *
54parse_version_string (const char *s, int *major, int *minor, int *micro) 55parse_version_string (const char *s, int *major, int *minor, int *micro)
55{ 56{
@@ -67,12 +68,15 @@ parse_version_string (const char *s, int *major, int *minor, int *micro)
67 return s; 68 return s;
68} 69}
69 70
71
70#ifdef HTTPS_SUPPORT 72#ifdef HTTPS_SUPPORT
71int 73int
72curl_uses_nss_ssl () 74curl_uses_nss_ssl ()
73{ 75{
74 return (strstr (curl_version (), " NSS/") != NULL) ? 0 : -1; 76 return (strstr (curl_version (), " NSS/") != NULL) ? 0 : -1;
75} 77}
78
79
76#endif /* HTTPS_SUPPORT */ 80#endif /* HTTPS_SUPPORT */
77 81
78/* 82/*
@@ -99,8 +103,7 @@ curl_check_version (const char *req_version)
99 * this call relies on the cURL string to be of the exact following format : 103 * this call relies on the cURL string to be of the exact following format :
100 * 'libcurl/7.16.4 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/0.6.5' OR 104 * 'libcurl/7.16.4 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/0.6.5' OR
101 * 'libcurl/7.18.2 GnuTLS/2.4.0 zlib/1.2.3.3 libidn/0.6.5' 105 * 'libcurl/7.18.2 GnuTLS/2.4.0 zlib/1.2.3.3 libidn/0.6.5'
102 */ 106 */curl_ver = strchr (ver, '/');
103 curl_ver = strchr (ver, '/');
104 if (curl_ver == NULL) 107 if (curl_ver == NULL)
105 return -1; 108 return -1;
106 curl_ver++; 109 curl_ver++;
@@ -113,11 +116,11 @@ curl_check_version (const char *req_version)
113 116
114 /* Compare version numbers. */ 117 /* Compare version numbers. */
115 if (((loc_major > rq_major) 118 if (((loc_major > rq_major)
116 || ((loc_major == rq_major)&&(loc_minor > rq_minor)) 119 || ((loc_major == rq_major) && (loc_minor > rq_minor))
117 || ((loc_major == rq_major)&&(loc_minor == rq_minor) 120 || ((loc_major == rq_major) && (loc_minor == rq_minor)
118 &&(loc_micro > rq_micro)) || ((loc_major == rq_major) 121 && (loc_micro > rq_micro)) || ((loc_major == rq_major)
119 &&(loc_minor == rq_minor) 122 && (loc_minor == rq_minor)
120 &&(loc_micro == rq_micro) )) == 0) 123 && (loc_micro == rq_micro) )) == 0)
121 { 124 {
122 fprintf (stderr, 125 fprintf (stderr,
123 "Error: running curl test depends on local libcurl version > %s\n", 126 "Error: running curl test depends on local libcurl version > %s\n",
@@ -164,11 +167,11 @@ curl_check_version (const char *req_version)
164 return -1; 167 return -1;
165 168
166 if (((loc_major > rq_major) 169 if (((loc_major > rq_major)
167 || ((loc_major == rq_major)&&(loc_minor > rq_minor)) 170 || ((loc_major == rq_major) && (loc_minor > rq_minor))
168 || ((loc_major == rq_major)&&(loc_minor == rq_minor) 171 || ((loc_major == rq_major) && (loc_minor == rq_minor)
169 &&(loc_micro > rq_micro)) || ((loc_major == rq_major) 172 && (loc_micro > rq_micro)) || ((loc_major == rq_major)
170 &&(loc_minor == rq_minor) 173 && (loc_minor == rq_minor)
171 &&(loc_micro == rq_micro) )) == 0) 174 && (loc_micro == rq_micro) )) == 0)
172 { 175 {
173 fprintf (stderr, 176 fprintf (stderr,
174 "Error: running curl test depends on local libcurl SSL version > %s\n", 177 "Error: running curl test depends on local libcurl SSL version > %s\n",
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c
index 41026896..6f29fbe5 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -101,7 +101,7 @@ testInternalSelectGet ()
101 { 101 {
102 const union MHD_DaemonInfo *dinfo; 102 const union MHD_DaemonInfo *dinfo;
103 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 103 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
104 if ((NULL == dinfo) ||(0 == dinfo->port) ) 104 if ((NULL == dinfo) || (0 == dinfo->port) )
105 { 105 {
106 MHD_stop_daemon (d); return 32; 106 MHD_stop_daemon (d); return 32;
107 } 107 }
@@ -177,10 +177,10 @@ testInternalSelectGet ()
177 if (EINTR != errno) 177 if (EINTR != errno)
178 abort (); 178 abort ();
179#else 179#else
180 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 180 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
181 ws. 181 ws.
182 fd_count) 182 fd_count)
183 ||(0 != es.fd_count) ) 183 || (0 != es.fd_count) )
184 abort (); 184 abort ();
185 Sleep (1000); 185 Sleep (1000);
186#endif 186#endif
diff --git a/src/testcurl/https/test_https_get.c b/src/testcurl/https/test_https_get.c
index 8f62e46c..c012fa46 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -74,7 +74,7 @@ test_secure_get (FILE *test_fd,
74 { 74 {
75 const union MHD_DaemonInfo *dinfo; 75 const union MHD_DaemonInfo *dinfo;
76 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 76 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
77 if ((NULL == dinfo) ||(0 == dinfo->port) ) 77 if ((NULL == dinfo) || (0 == dinfo->port) )
78 { 78 {
79 MHD_stop_daemon (d); return -1; 79 MHD_stop_daemon (d); return -1;
80 } 80 }
@@ -148,8 +148,8 @@ curlExcessFound (CURL *c,
148 (void) c; /* Unused. Silence compiler warning. */ 148 (void) c; /* Unused. Silence compiler warning. */
149 149
150 if ((CURLINFO_TEXT == type) 150 if ((CURLINFO_TEXT == type)
151 &&(size >= str_size) 151 && (size >= str_size)
152 &&(0 == strncmp (excess_found, data, str_size))) 152 && (0 == strncmp (excess_found, data, str_size)))
153 *(int *) cls = 1; 153 *(int *) cls = 1;
154 return 0; 154 return 0;
155} 155}
@@ -189,7 +189,7 @@ testEmptyGet (int poll_flag)
189 { 189 {
190 const union MHD_DaemonInfo *dinfo; 190 const union MHD_DaemonInfo *dinfo;
191 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 191 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
192 if ((NULL == dinfo) ||(0 == dinfo->port) ) 192 if ((NULL == dinfo) || (0 == dinfo->port) )
193 { 193 {
194 MHD_stop_daemon (d); return 32; 194 MHD_stop_daemon (d); return 32;
195 } 195 }
diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c
index 8ca976c2..3fc0e189 100644
--- a/src/testcurl/https/test_https_get_parallel_threads.c
+++ b/src/testcurl/https/test_https_get_parallel_threads.c
@@ -70,6 +70,7 @@ https_transfer_thread_adapter (void *args)
70 return &nonnull; 70 return &nonnull;
71} 71}
72 72
73
73/** 74/**
74 * Test non-parallel requests. 75 * Test non-parallel requests.
75 * 76 *
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c
index ce74c1d7..e5bd73f5 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -118,7 +118,7 @@ testExternalGet (int flags)
118 { 118 {
119 const union MHD_DaemonInfo *dinfo; 119 const union MHD_DaemonInfo *dinfo;
120 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 120 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
121 if ((NULL == dinfo) ||(0 == dinfo->port) ) 121 if ((NULL == dinfo) || (0 == dinfo->port) )
122 { 122 {
123 MHD_stop_daemon (d); return 32; 123 MHD_stop_daemon (d); return 32;
124 } 124 }
@@ -201,10 +201,10 @@ testExternalGet (int flags)
201 if (EINTR != errno) 201 if (EINTR != errno)
202 abort (); 202 abort ();
203#else 203#else
204 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 204 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
205 ws. 205 ws.
206 fd_count) 206 fd_count)
207 ||(0 != es.fd_count) ) 207 || (0 != es.fd_count) )
208 abort (); 208 abort ();
209 Sleep (1000); 209 Sleep (1000);
210#endif 210#endif
diff --git a/src/testcurl/https/test_https_multi_daemon.c b/src/testcurl/https/test_https_multi_daemon.c
index de153ff6..598d5592 100644
--- a/src/testcurl/https/test_https_multi_daemon.c
+++ b/src/testcurl/https/test_https_multi_daemon.c
@@ -78,7 +78,7 @@ test_concurent_daemon_pair (void *cls,
78 { 78 {
79 const union MHD_DaemonInfo *dinfo; 79 const union MHD_DaemonInfo *dinfo;
80 dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT); 80 dinfo = MHD_get_daemon_info (d1, MHD_DAEMON_INFO_BIND_PORT);
81 if ((NULL == dinfo) ||(0 == dinfo->port) ) 81 if ((NULL == dinfo) || (0 == dinfo->port) )
82 { 82 {
83 MHD_stop_daemon (d1); return -1; 83 MHD_stop_daemon (d1); return -1;
84 } 84 }
@@ -103,7 +103,7 @@ test_concurent_daemon_pair (void *cls,
103 { 103 {
104 const union MHD_DaemonInfo *dinfo; 104 const union MHD_DaemonInfo *dinfo;
105 dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT); 105 dinfo = MHD_get_daemon_info (d2, MHD_DAEMON_INFO_BIND_PORT);
106 if ((NULL == dinfo) ||(0 == dinfo->port) ) 106 if ((NULL == dinfo) || (0 == dinfo->port) )
107 { 107 {
108 MHD_stop_daemon (d1); 108 MHD_stop_daemon (d1);
109 MHD_stop_daemon (d2); 109 MHD_stop_daemon (d2);
diff --git a/src/testcurl/https/test_https_session_info.c b/src/testcurl/https/test_https_session_info.c
index b692af15..e961edc4 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -132,7 +132,7 @@ test_query_session ()
132 { 132 {
133 const union MHD_DaemonInfo *dinfo; 133 const union MHD_DaemonInfo *dinfo;
134 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 134 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
135 if ((NULL == dinfo) ||(0 == dinfo->port) ) 135 if ((NULL == dinfo) || (0 == dinfo->port) )
136 { 136 {
137 MHD_stop_daemon (d); 137 MHD_stop_daemon (d);
138 free (cbc.buf); 138 free (cbc.buf);
@@ -188,6 +188,8 @@ test_query_session ()
188 free (cbc.buf); 188 free (cbc.buf);
189 return 0; 189 return 0;
190} 190}
191
192
191#endif 193#endif
192 194
193int 195int
diff --git a/src/testcurl/https/test_https_sni.c b/src/testcurl/https/test_https_sni.c
index 16576656..6effd313 100644
--- a/src/testcurl/https/test_https_sni.c
+++ b/src/testcurl/https/test_https_sni.c
@@ -120,7 +120,6 @@ load_keys (const char *hostname,
120} 120}
121 121
122 122
123
124/** 123/**
125 * @param session the session we are giving a cert for 124 * @param session the session we are giving a cert for
126 * @param req_ca_dn NULL on server side 125 * @param req_ca_dn NULL on server side
@@ -297,7 +296,7 @@ main (int argc, char *const *argv)
297 { 296 {
298 const union MHD_DaemonInfo *dinfo; 297 const union MHD_DaemonInfo *dinfo;
299 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 298 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
300 if ((NULL == dinfo) ||(0 == dinfo->port) ) 299 if ((NULL == dinfo) || (0 == dinfo->port) )
301 { 300 {
302 MHD_stop_daemon (d); return -1; 301 MHD_stop_daemon (d); return -1;
303 } 302 }
@@ -318,10 +317,13 @@ main (int argc, char *const *argv)
318 317
319#else 318#else
320 319
321int main (void) 320int
321main (void)
322{ 322{
323 fprintf (stderr, 323 fprintf (stderr,
324 "SNI not supported by GnuTLS < 3.0\n"); 324 "SNI not supported by GnuTLS < 3.0\n");
325 return 77; 325 return 77;
326} 326}
327
328
327#endif 329#endif
diff --git a/src/testcurl/https/test_https_time_out.c b/src/testcurl/https/test_https_time_out.c
index d2f4d92c..7721d486 100644
--- a/src/testcurl/https/test_https_time_out.c
+++ b/src/testcurl/https/test_https_time_out.c
@@ -144,7 +144,7 @@ main (int argc, char *const *argv)
144 { 144 {
145 const union MHD_DaemonInfo *dinfo; 145 const union MHD_DaemonInfo *dinfo;
146 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 146 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
147 if ((NULL == dinfo) ||(0 == dinfo->port) ) 147 if ((NULL == dinfo) || (0 == dinfo->port) )
148 { 148 {
149 MHD_stop_daemon (d); return -1; 149 MHD_stop_daemon (d); return -1;
150 } 150 }
diff --git a/src/testcurl/https/test_tls_authentication.c b/src/testcurl/https/test_tls_authentication.c
index 51fb5331..7ca75138 100644
--- a/src/testcurl/https/test_tls_authentication.c
+++ b/src/testcurl/https/test_tls_authentication.c
@@ -38,7 +38,6 @@ extern const char srv_signed_cert_pem[];
38extern const char srv_signed_key_pem[]; 38extern const char srv_signed_key_pem[];
39 39
40 40
41
42/* perform a HTTP GET request via SSL/TLS */ 41/* perform a HTTP GET request via SSL/TLS */
43static int 42static int
44test_secure_get (void *cls, char *cipher_suite, int proto_version) 43test_secure_get (void *cls, char *cipher_suite, int proto_version)
@@ -70,7 +69,7 @@ test_secure_get (void *cls, char *cipher_suite, int proto_version)
70 { 69 {
71 const union MHD_DaemonInfo *dinfo; 70 const union MHD_DaemonInfo *dinfo;
72 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 71 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
73 if ((NULL == dinfo) ||(0 == dinfo->port) ) 72 if ((NULL == dinfo) || (0 == dinfo->port) )
74 { 73 {
75 MHD_stop_daemon (d); return -1; 74 MHD_stop_daemon (d); return -1;
76 } 75 }
diff --git a/src/testcurl/https/test_tls_extensions.c b/src/testcurl/https/test_tls_extensions.c
index f5095359..338fcd91 100644
--- a/src/testcurl/https/test_tls_extensions.c
+++ b/src/testcurl/https/test_tls_extensions.c
@@ -132,8 +132,7 @@ test_hello_extension (gnutls_session_t session, int port, extensions_t exten_t,
132 * len = ciphersuite data + 2 bytes ciphersuite length \ 132 * len = ciphersuite data + 2 bytes ciphersuite length \
133 * 1 byte compression length + 1 byte compression data + \ 133 * 1 byte compression length + 1 byte compression data + \
134 * 2 bytes extension length, extensions data 134 * 2 bytes extension length, extensions data
135 */ 135 */ciphersuite_len = MHD__gnutls_copy_ciphersuites (session, extdata,
136 ciphersuite_len = MHD__gnutls_copy_ciphersuites (session, extdata,
137 sizeof (extdata)); 136 sizeof (extdata));
138 exten_data_len = ext_count * (2 + 2 + ext_length); 137 exten_data_len = ext_count * (2 + 2 + ext_length);
139 datalen += ciphersuite_len + 2 + 2 + exten_data_len; 138 datalen += ciphersuite_len + 2 + 2 + exten_data_len;
@@ -259,7 +258,7 @@ main (int argc, char *const *argv)
259 { 258 {
260 const union MHD_DaemonInfo *dinfo; 259 const union MHD_DaemonInfo *dinfo;
261 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 260 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
262 if ((NULL == dinfo) ||(0 == dinfo->port) ) 261 if ((NULL == dinfo) || (0 == dinfo->port) )
263 { 262 {
264 MHD_stop_daemon (d); return -1; 263 MHD_stop_daemon (d); return -1;
265 } 264 }
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index 9d988451..f68f5979 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -232,6 +232,7 @@ http_dummy_ahc (void *cls,
232 return 0; 232 return 0;
233} 233}
234 234
235
235/** 236/**
236 * send a test http request to the daemon 237 * send a test http request to the daemon
237 * @param url 238 * @param url
@@ -414,6 +415,7 @@ cleanup:
414 return ret; 415 return ret;
415} 416}
416 417
418
417/** 419/**
418 * setup test case 420 * setup test case
419 * 421 *
@@ -439,7 +441,7 @@ setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list
439 { 441 {
440 const union MHD_DaemonInfo *dinfo; 442 const union MHD_DaemonInfo *dinfo;
441 dinfo = MHD_get_daemon_info (*d, MHD_DAEMON_INFO_BIND_PORT); 443 dinfo = MHD_get_daemon_info (*d, MHD_DAEMON_INFO_BIND_PORT);
442 if ((NULL == dinfo) ||(0 == dinfo->port) ) 444 if ((NULL == dinfo) || (0 == dinfo->port) )
443 { 445 {
444 MHD_stop_daemon (*d); 446 MHD_stop_daemon (*d);
445 return 0; 447 return 0;
@@ -450,12 +452,14 @@ setup_testcase (struct MHD_Daemon **d, int port, int daemon_flags, va_list
450 return port; 452 return port;
451} 453}
452 454
455
453void 456void
454teardown_testcase (struct MHD_Daemon *d) 457teardown_testcase (struct MHD_Daemon *d)
455{ 458{
456 MHD_stop_daemon (d); 459 MHD_stop_daemon (d);
457} 460}
458 461
462
459int 463int
460setup_session (gnutls_session_t *session, 464setup_session (gnutls_session_t *session,
461 gnutls_datum_t *key, 465 gnutls_datum_t *key,
@@ -501,6 +505,7 @@ setup_session (gnutls_session_t *session,
501 return 0; 505 return 0;
502} 506}
503 507
508
504int 509int
505teardown_session (gnutls_session_t session, 510teardown_session (gnutls_session_t session,
506 gnutls_datum_t *key, 511 gnutls_datum_t *key,
@@ -518,6 +523,7 @@ teardown_session (gnutls_session_t session,
518 return 0; 523 return 0;
519} 524}
520 525
526
521/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */ 527/* TODO test_wrap: change sig to (setup_func, test, va_list test_arg) */
522int 528int
523test_wrap (const char *test_name, int 529test_wrap (const char *test_name, int
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 112046d5..53992b17 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -150,6 +150,7 @@ copyBuffer (void *ptr,
150 return size * nmemb; 150 return size * nmemb;
151} 151}
152 152
153
153static int 154static int
154ahc_echo (void *cls, 155ahc_echo (void *cls,
155 struct MHD_Connection *connection, 156 struct MHD_Connection *connection,
@@ -205,7 +206,7 @@ testInternalGet (int port, int poll_flag)
205 { 206 {
206 const union MHD_DaemonInfo *dinfo; 207 const union MHD_DaemonInfo *dinfo;
207 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 208 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
208 if ((NULL == dinfo) ||(0 == dinfo->port) ) 209 if ((NULL == dinfo) || (0 == dinfo->port) )
209 { 210 {
210 MHD_stop_daemon (d); return 32; 211 MHD_stop_daemon (d); return 32;
211 } 212 }
@@ -284,7 +285,7 @@ testMultithreadedGet (int port, int poll_flag)
284 { 285 {
285 const union MHD_DaemonInfo *dinfo; 286 const union MHD_DaemonInfo *dinfo;
286 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 287 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
287 if ((NULL == dinfo) ||(0 == dinfo->port) ) 288 if ((NULL == dinfo) || (0 == dinfo->port) )
288 { 289 {
289 MHD_stop_daemon (d); return 32; 290 MHD_stop_daemon (d); return 32;
290 } 291 }
@@ -339,6 +340,7 @@ testMultithreadedGet (int port, int poll_flag)
339 return 0; 340 return 0;
340} 341}
341 342
343
342static int 344static int
343testMultithreadedPoolGet (int port, int poll_flag) 345testMultithreadedPoolGet (int port, int poll_flag)
344{ 346{
@@ -365,7 +367,7 @@ testMultithreadedPoolGet (int port, int poll_flag)
365 { 367 {
366 const union MHD_DaemonInfo *dinfo; 368 const union MHD_DaemonInfo *dinfo;
367 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 369 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
368 if ((NULL == dinfo) ||(0 == dinfo->port) ) 370 if ((NULL == dinfo) || (0 == dinfo->port) )
369 { 371 {
370 MHD_stop_daemon (d); return 32; 372 MHD_stop_daemon (d); return 32;
371 } 373 }
@@ -417,6 +419,7 @@ testMultithreadedPoolGet (int port, int poll_flag)
417 return 0; 419 return 0;
418} 420}
419 421
422
420static int 423static int
421testExternalGet (int port) 424testExternalGet (int port)
422{ 425{
@@ -458,7 +461,7 @@ testExternalGet (int port)
458 { 461 {
459 const union MHD_DaemonInfo *dinfo; 462 const union MHD_DaemonInfo *dinfo;
460 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 463 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
461 if ((NULL == dinfo) ||(0 == dinfo->port) ) 464 if ((NULL == dinfo) || (0 == dinfo->port) )
462 { 465 {
463 MHD_stop_daemon (d); return 32; 466 MHD_stop_daemon (d); return 32;
464 } 467 }
@@ -535,10 +538,10 @@ testExternalGet (int port)
535 if (EINTR != errno) 538 if (EINTR != errno)
536 abort (); 539 abort ();
537#else 540#else
538 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 541 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
539 ws. 542 ws.
540 fd_count) 543 fd_count)
541 ||(0 != es.fd_count) ) 544 || (0 != es.fd_count) )
542 abort (); 545 abort ();
543 Sleep (1000); 546 Sleep (1000);
544#endif 547#endif
@@ -566,8 +569,7 @@ testExternalGet (int port)
566 in actual runtime right now, even though the 569 in actual runtime right now, even though the
567 number of select calls is virtually cut in half 570 number of select calls is virtually cut in half
568 (and 'select' is the most expensive of our system 571 (and 'select' is the most expensive of our system
569 calls according to 'strace') */ 572 calls according to 'strace') */if (0)
570 if (0)
571 MHD_run (d); 573 MHD_run (d);
572 else 574 else
573 MHD_run_from_select (d, &rs, &ws, &es); 575 MHD_run_from_select (d, &rs, &ws, &es);
@@ -600,7 +602,7 @@ main (int argc, char *const *argv)
600 int port = 1130; 602 int port = 1130;
601 (void) argc; /* Unused. Silent compiler warning. */ 603 (void) argc; /* Unused. Silent compiler warning. */
602 604
603 if ((NULL == argv)||(0 == argv[0])) 605 if ((NULL == argv) || (0 == argv[0]))
604 return 99; 606 return 99;
605 oneone = has_in_name (argv[0], "11"); 607 oneone = has_in_name (argv[0], "11");
606 if (oneone) 608 if (oneone)
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c
index b4cd6d8d..12c57dae 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -276,7 +276,7 @@ testInternalGet (int port, int poll_flag)
276 { 276 {
277 const union MHD_DaemonInfo *dinfo; 277 const union MHD_DaemonInfo *dinfo;
278 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 278 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
279 if ((NULL == dinfo) ||(0 == dinfo->port) ) 279 if ((NULL == dinfo) || (0 == dinfo->port) )
280 { 280 {
281 MHD_stop_daemon (d); return 32; 281 MHD_stop_daemon (d); return 32;
282 } 282 }
@@ -327,7 +327,7 @@ testMultithreadedGet (int port, int poll_flag)
327 { 327 {
328 const union MHD_DaemonInfo *dinfo; 328 const union MHD_DaemonInfo *dinfo;
329 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 329 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
330 if ((NULL == dinfo) ||(0 == dinfo->port) ) 330 if ((NULL == dinfo) || (0 == dinfo->port) )
331 { 331 {
332 MHD_stop_daemon (d); return 32; 332 MHD_stop_daemon (d); return 32;
333 } 333 }
@@ -375,7 +375,7 @@ testMultithreadedPoolGet (int port, int poll_flag)
375 { 375 {
376 const union MHD_DaemonInfo *dinfo; 376 const union MHD_DaemonInfo *dinfo;
377 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 377 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
378 if ((NULL == dinfo) ||(0 == dinfo->port) ) 378 if ((NULL == dinfo) || (0 == dinfo->port) )
379 { 379 {
380 MHD_stop_daemon (d); return 32; 380 MHD_stop_daemon (d); return 32;
381 } 381 }
@@ -423,7 +423,7 @@ testExternalGet (int port)
423 { 423 {
424 const union MHD_DaemonInfo *dinfo; 424 const union MHD_DaemonInfo *dinfo;
425 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 425 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
426 if ((NULL == dinfo) ||(0 == dinfo->port) ) 426 if ((NULL == dinfo) || (0 == dinfo->port) )
427 { 427 {
428 MHD_stop_daemon (d); return 32; 428 MHD_stop_daemon (d); return 32;
429 } 429 }
@@ -462,9 +462,10 @@ testExternalGet (int port)
462 "select failed: %s\n", 462 "select failed: %s\n",
463 strerror (errno)); 463 strerror (errno));
464#else 464#else
465 if ((WSAEINVAL == WSAGetLastError ()) &&(0 == rs.fd_count) &&(0 == 465 if ((WSAEINVAL == WSAGetLastError ()) && (0 == rs.fd_count) && (0 ==
466 ws.fd_count) 466 ws.
467 &&(0 == es.fd_count) ) 467 fd_count)
468 && (0 == es.fd_count) )
468 { 469 {
469 Sleep (1000); 470 Sleep (1000);
470 continue; 471 continue;
@@ -478,7 +479,7 @@ testExternalGet (int port)
478 479
479 stop ("external select"); 480 stop ("external select");
480 MHD_stop_daemon (d); 481 MHD_stop_daemon (d);
481 if ((0 != pthread_join (pid, (void**) &ret_val))|| 482 if ((0 != pthread_join (pid, (void**) &ret_val)) ||
482 (NULL != ret_val) ) 483 (NULL != ret_val) )
483 { 484 {
484 fprintf (stderr, 485 fprintf (stderr,
@@ -498,7 +499,7 @@ main (int argc, char *const *argv)
498 int port = 1100; 499 int port = 1100;
499 (void) argc; /* Unused. Silent compiler warning. */ 500 (void) argc; /* Unused. Silent compiler warning. */
500 501
501 if ((NULL == argv)||(0 == argv[0])) 502 if ((NULL == argv) || (0 == argv[0]))
502 return 99; 503 return 99;
503 oneone = has_in_name (argv[0], "11"); 504 oneone = has_in_name (argv[0], "11");
504 if (oneone) 505 if (oneone)
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index a0480932..2e2be470 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -150,7 +150,7 @@ main (int argc, char **argv)
150 { 150 {
151 const union MHD_DaemonInfo *dinfo; 151 const union MHD_DaemonInfo *dinfo;
152 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 152 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
153 if ((NULL == dinfo) ||(0 == dinfo->port) ) 153 if ((NULL == dinfo) || (0 == dinfo->port) )
154 { 154 {
155 MHD_stop_daemon (d); return 48; 155 MHD_stop_daemon (d); return 48;
156 } 156 }
@@ -218,9 +218,10 @@ main (int argc, char **argv)
218 if (EINTR != errno) 218 if (EINTR != errno)
219 abort (); 219 abort ();
220#else 220#else
221 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 221 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
222 ws.fd_count) 222 ws.
223 ||(0 != es.fd_count) ) 223 fd_count)
224 || (0 != es.fd_count) )
224 abort (); 225 abort ();
225 Sleep (1000); 226 Sleep (1000);
226#endif 227#endif
diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c
index 02f4fffd..750fddc8 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -95,6 +95,7 @@ thread_watchdog (void *param)
95 return NULL; 95 return NULL;
96} 96}
97 97
98
98pthread_t watchdog_tid; 99pthread_t watchdog_tid;
99 100
100static void 101static void
@@ -110,6 +111,7 @@ start_watchdog (int timeout, const char *obj_name)
110 } 111 }
111} 112}
112 113
114
113static void 115static void
114stop_watchdog (void) 116stop_watchdog (void)
115{ 117{
@@ -121,6 +123,7 @@ stop_watchdog (void)
121 } 123 }
122} 124}
123 125
126
124static size_t 127static size_t
125copyBuffer (void *ptr, 128copyBuffer (void *ptr,
126 size_t size, size_t nmemb, 129 size_t size, size_t nmemb,
@@ -163,6 +166,7 @@ ahc_echo (void *cls,
163 return ret; 166 return ret;
164} 167}
165 168
169
166static void * 170static void *
167thread_gets (void *param) 171thread_gets (void *param)
168{ 172{
@@ -204,6 +208,7 @@ thread_gets (void *param)
204 return NULL; 208 return NULL;
205} 209}
206 210
211
207static void * 212static void *
208do_gets (void *param) 213do_gets (void *param)
209{ 214{
@@ -239,7 +244,8 @@ do_gets (void *param)
239} 244}
240 245
241 246
242pthread_t start_gets (int port) 247pthread_t
248start_gets (int port)
243{ 249{
244 pthread_t tid; 250 pthread_t tid;
245 continue_requesting = 1; 251 continue_requesting = 1;
@@ -272,7 +278,7 @@ testMultithreadedGet (int port,
272 { 278 {
273 const union MHD_DaemonInfo *dinfo; 279 const union MHD_DaemonInfo *dinfo;
274 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 280 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
275 if ((NULL == dinfo) ||(0 == dinfo->port) ) 281 if ((NULL == dinfo) || (0 == dinfo->port) )
276 { 282 {
277 MHD_stop_daemon (d); return 32; 283 MHD_stop_daemon (d); return 32;
278 } 284 }
@@ -309,7 +315,7 @@ testMultithreadedPoolGet (int port,
309 { 315 {
310 const union MHD_DaemonInfo *dinfo; 316 const union MHD_DaemonInfo *dinfo;
311 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 317 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
312 if ((NULL == dinfo) ||(0 == dinfo->port) ) 318 if ((NULL == dinfo) || (0 == dinfo->port) )
313 { 319 {
314 MHD_stop_daemon (d); return 32; 320 MHD_stop_daemon (d); return 32;
315 } 321 }
@@ -342,7 +348,7 @@ main (int argc, char *const *argv)
342 /* Do reuse connection, otherwise all available local ports may exhausted. */ 348 /* Do reuse connection, otherwise all available local ports may exhausted. */
343 oneone = 1; 349 oneone = 1;
344 350
345 if ((0 != port)&& oneone) 351 if ((0 != port) && oneone)
346 port += 5; 352 port += 5;
347 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 353 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
348 return 2; 354 return 2;
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index a3d14661..8854cde7 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -67,6 +67,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
67 return wrt; 67 return wrt;
68} 68}
69 69
70
70static size_t 71static size_t
71copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 72copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
72{ 73{
@@ -79,6 +80,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
79 return size * nmemb; 80 return size * nmemb;
80} 81}
81 82
83
82static int 84static int
83ahc_echo (void *cls, 85ahc_echo (void *cls,
84 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
@@ -148,7 +150,7 @@ testInternalDelete ()
148 { 150 {
149 const union MHD_DaemonInfo *dinfo; 151 const union MHD_DaemonInfo *dinfo;
150 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 152 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
151 if ((NULL == dinfo) ||(0 == dinfo->port) ) 153 if ((NULL == dinfo) || (0 == dinfo->port) )
152 { 154 {
153 MHD_stop_daemon (d); return 32; 155 MHD_stop_daemon (d); return 32;
154 } 156 }
@@ -224,7 +226,7 @@ testMultithreadedDelete ()
224 { 226 {
225 const union MHD_DaemonInfo *dinfo; 227 const union MHD_DaemonInfo *dinfo;
226 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 228 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
227 if ((NULL == dinfo) ||(0 == dinfo->port) ) 229 if ((NULL == dinfo) || (0 == dinfo->port) )
228 { 230 {
229 MHD_stop_daemon (d); return 32; 231 MHD_stop_daemon (d); return 32;
230 } 232 }
@@ -270,6 +272,7 @@ testMultithreadedDelete ()
270 return 0; 272 return 0;
271} 273}
272 274
275
273static int 276static int
274testMultithreadedPoolDelete () 277testMultithreadedPoolDelete ()
275{ 278{
@@ -300,7 +303,7 @@ testMultithreadedPoolDelete ()
300 { 303 {
301 const union MHD_DaemonInfo *dinfo; 304 const union MHD_DaemonInfo *dinfo;
302 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 305 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
303 if ((NULL == dinfo) ||(0 == dinfo->port) ) 306 if ((NULL == dinfo) || (0 == dinfo->port) )
304 { 307 {
305 MHD_stop_daemon (d); return 32; 308 MHD_stop_daemon (d); return 32;
306 } 309 }
@@ -391,7 +394,7 @@ testExternalDelete ()
391 { 394 {
392 const union MHD_DaemonInfo *dinfo; 395 const union MHD_DaemonInfo *dinfo;
393 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 396 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
394 if ((NULL == dinfo) ||(0 == dinfo->port) ) 397 if ((NULL == dinfo) || (0 == dinfo->port) )
395 { 398 {
396 MHD_stop_daemon (d); return 32; 399 MHD_stop_daemon (d); return 32;
397 } 400 }
@@ -469,9 +472,10 @@ testExternalDelete ()
469 if (EINTR != errno) 472 if (EINTR != errno)
470 abort (); 473 abort ();
471#else 474#else
472 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 475 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
473 ws.fd_count) 476 ws.
474 ||(0 != es.fd_count) ) 477 fd_count)
478 || (0 != es.fd_count) )
475 abort (); 479 abort ();
476 Sleep (1000); 480 Sleep (1000);
477#endif 481#endif
@@ -513,14 +517,13 @@ testExternalDelete ()
513} 517}
514 518
515 519
516
517int 520int
518main (int argc, char *const *argv) 521main (int argc, char *const *argv)
519{ 522{
520 unsigned int errorCount = 0; 523 unsigned int errorCount = 0;
521 (void) argc; /* Unused. Silent compiler warning. */ 524 (void) argc; /* Unused. Silent compiler warning. */
522 525
523 if ((NULL == argv)||(0 == argv[0])) 526 if ((NULL == argv) || (0 == argv[0]))
524 return 99; 527 return 99;
525 oneone = has_in_name (argv[0], "11"); 528 oneone = has_in_name (argv[0], "11");
526 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 529 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c
index 5bacdc76..f1927d1a 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -70,6 +70,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
70 return size * nmemb; 70 return size * nmemb;
71} 71}
72 72
73
73static int 74static int
74ahc_echo (void *cls, 75ahc_echo (void *cls,
75 struct MHD_Connection *connection, 76 struct MHD_Connection *connection,
@@ -214,7 +215,7 @@ testDigestAuth ()
214 { 215 {
215 const union MHD_DaemonInfo *dinfo; 216 const union MHD_DaemonInfo *dinfo;
216 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 217 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
217 if ((NULL == dinfo) ||(0 == dinfo->port) ) 218 if ((NULL == dinfo) || (0 == dinfo->port) )
218 { 219 {
219 MHD_stop_daemon (d); return 32; 220 MHD_stop_daemon (d); return 32;
220 } 221 }
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index 09cae5f6..3ab05d9a 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -202,7 +202,7 @@ testInternalGet (int poll_flag)
202 { 202 {
203 const union MHD_DaemonInfo *dinfo; 203 const union MHD_DaemonInfo *dinfo;
204 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 204 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
205 if ((NULL == dinfo) ||(0 == dinfo->port) ) 205 if ((NULL == dinfo) || (0 == dinfo->port) )
206 { 206 {
207 MHD_stop_daemon (d); return 32; 207 MHD_stop_daemon (d); return 32;
208 } 208 }
@@ -276,7 +276,7 @@ testMultithreadedGet (int poll_flag)
276 { 276 {
277 const union MHD_DaemonInfo *dinfo; 277 const union MHD_DaemonInfo *dinfo;
278 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 278 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
279 if ((NULL == dinfo) ||(0 == dinfo->port) ) 279 if ((NULL == dinfo) || (0 == dinfo->port) )
280 { 280 {
281 MHD_stop_daemon (d); return 32; 281 MHD_stop_daemon (d); return 32;
282 } 282 }
@@ -350,7 +350,7 @@ testMultithreadedPoolGet (int poll_flag)
350 { 350 {
351 const union MHD_DaemonInfo *dinfo; 351 const union MHD_DaemonInfo *dinfo;
352 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 352 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
353 if ((NULL == dinfo) ||(0 == dinfo->port) ) 353 if ((NULL == dinfo) || (0 == dinfo->port) )
354 { 354 {
355 MHD_stop_daemon (d); return 32; 355 MHD_stop_daemon (d); return 32;
356 } 356 }
@@ -433,7 +433,7 @@ testExternalGet ()
433 { 433 {
434 const union MHD_DaemonInfo *dinfo; 434 const union MHD_DaemonInfo *dinfo;
435 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 435 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
436 if ((NULL == dinfo) ||(0 == dinfo->port) ) 436 if ((NULL == dinfo) || (0 == dinfo->port) )
437 { 437 {
438 MHD_stop_daemon (d); return 32; 438 MHD_stop_daemon (d); return 32;
439 } 439 }
@@ -510,9 +510,10 @@ testExternalGet ()
510 if (EINTR != errno) 510 if (EINTR != errno)
511 abort (); 511 abort ();
512#else 512#else
513 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 513 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
514 ws.fd_count) 514 ws.
515 ||(0 != es.fd_count) ) 515 fd_count)
516 || (0 != es.fd_count) )
516 _exit (99); 517 _exit (99);
517 Sleep (1000); 518 Sleep (1000);
518#endif 519#endif
@@ -598,7 +599,7 @@ testUnknownPortGet (int poll_flag)
598 { 599 {
599 const union MHD_DaemonInfo *dinfo; 600 const union MHD_DaemonInfo *dinfo;
600 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 601 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
601 if ((NULL == dinfo) ||(0 == dinfo->port) ) 602 if ((NULL == dinfo) || (0 == dinfo->port) )
602 { 603 {
603 MHD_stop_daemon (d); return 32; 604 MHD_stop_daemon (d); return 32;
604 } 605 }
@@ -673,7 +674,7 @@ testStopRace (int poll_flag)
673 { 674 {
674 const union MHD_DaemonInfo *dinfo; 675 const union MHD_DaemonInfo *dinfo;
675 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 676 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
676 if ((NULL == dinfo) ||(0 == dinfo->port) ) 677 if ((NULL == dinfo) || (0 == dinfo->port) )
677 { 678 {
678 MHD_stop_daemon (d); return 32; 679 MHD_stop_daemon (d); return 32;
679 } 680 }
@@ -769,8 +770,8 @@ curlExcessFound (CURL *c,
769 (void) c; /* Unused. Silent compiler warning. */ 770 (void) c; /* Unused. Silent compiler warning. */
770 771
771 if ((CURLINFO_TEXT == type) 772 if ((CURLINFO_TEXT == type)
772 &&(size >= str_size) 773 && (size >= str_size)
773 &&(0 == strncmp (excess_found, data, str_size))) 774 && (0 == strncmp (excess_found, data, str_size)))
774 *(int *) cls = 1; 775 *(int *) cls = 1;
775 return 0; 776 return 0;
776} 777}
@@ -809,7 +810,7 @@ testEmptyGet (int poll_flag)
809 { 810 {
810 const union MHD_DaemonInfo *dinfo; 811 const union MHD_DaemonInfo *dinfo;
811 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 812 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
812 if ((NULL == dinfo) ||(0 == dinfo->port) ) 813 if ((NULL == dinfo) || (0 == dinfo->port) )
813 { 814 {
814 MHD_stop_daemon (d); return 32; 815 MHD_stop_daemon (d); return 32;
815 } 816 }
@@ -860,7 +861,7 @@ main (int argc, char *const *argv)
860 unsigned int test_result = 0; 861 unsigned int test_result = 0;
861 int verbose = 0; 862 int verbose = 0;
862 863
863 if ((NULL == argv)||(0 == argv[0])) 864 if ((NULL == argv) || (0 == argv[0]))
864 return 99; 865 return 99;
865 oneone = has_in_name (argv[0], "11"); 866 oneone = has_in_name (argv[0], "11");
866 verbose = has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose"); 867 verbose = has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose");
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 9916a902..daf690f1 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -178,6 +178,7 @@ validate (struct CBC cbc, int ebase)
178 return 0; 178 return 0;
179} 179}
180 180
181
181static int 182static int
182testInternalGet () 183testInternalGet ()
183{ 184{
@@ -204,7 +205,7 @@ testInternalGet ()
204 { 205 {
205 const union MHD_DaemonInfo *dinfo; 206 const union MHD_DaemonInfo *dinfo;
206 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 207 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
207 if ((NULL == dinfo) ||(0 == dinfo->port) ) 208 if ((NULL == dinfo) || (0 == dinfo->port) )
208 { 209 {
209 MHD_stop_daemon (d); return 32; 210 MHD_stop_daemon (d); return 32;
210 } 211 }
@@ -237,6 +238,7 @@ testInternalGet ()
237 return validate (cbc, 4); 238 return validate (cbc, 4);
238} 239}
239 240
241
240static int 242static int
241testMultithreadedGet () 243testMultithreadedGet ()
242{ 244{
@@ -264,7 +266,7 @@ testMultithreadedGet ()
264 { 266 {
265 const union MHD_DaemonInfo *dinfo; 267 const union MHD_DaemonInfo *dinfo;
266 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 268 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
267 if ((NULL == dinfo) ||(0 == dinfo->port) ) 269 if ((NULL == dinfo) || (0 == dinfo->port) )
268 { 270 {
269 MHD_stop_daemon (d); return 32; 271 MHD_stop_daemon (d); return 32;
270 } 272 }
@@ -297,6 +299,7 @@ testMultithreadedGet ()
297 return validate (cbc, 64); 299 return validate (cbc, 64);
298} 300}
299 301
302
300static int 303static int
301testMultithreadedPoolGet () 304testMultithreadedPoolGet ()
302{ 305{
@@ -324,7 +327,7 @@ testMultithreadedPoolGet ()
324 { 327 {
325 const union MHD_DaemonInfo *dinfo; 328 const union MHD_DaemonInfo *dinfo;
326 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 329 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
327 if ((NULL == dinfo) ||(0 == dinfo->port) ) 330 if ((NULL == dinfo) || (0 == dinfo->port) )
328 { 331 {
329 MHD_stop_daemon (d); return 32; 332 MHD_stop_daemon (d); return 32;
330 } 333 }
@@ -357,6 +360,7 @@ testMultithreadedPoolGet ()
357 return validate (cbc, 64); 360 return validate (cbc, 64);
358} 361}
359 362
363
360static int 364static int
361testExternalGet () 365testExternalGet ()
362{ 366{
@@ -398,7 +402,7 @@ testExternalGet ()
398 { 402 {
399 const union MHD_DaemonInfo *dinfo; 403 const union MHD_DaemonInfo *dinfo;
400 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 404 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
401 if ((NULL == dinfo) ||(0 == dinfo->port) ) 405 if ((NULL == dinfo) || (0 == dinfo->port) )
402 { 406 {
403 MHD_stop_daemon (d); return 32; 407 MHD_stop_daemon (d); return 32;
404 } 408 }
@@ -468,9 +472,10 @@ testExternalGet ()
468 if (EINTR != errno) 472 if (EINTR != errno)
469 abort (); 473 abort ();
470#else 474#else
471 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 475 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
472 ws.fd_count) 476 ws.
473 ||(0 != es.fd_count) ) 477 fd_count)
478 || (0 != es.fd_count) )
474 abort (); 479 abort ();
475 Sleep (1000); 480 Sleep (1000);
476#endif 481#endif
@@ -508,7 +513,6 @@ testExternalGet ()
508} 513}
509 514
510 515
511
512int 516int
513main (int argc, char *const *argv) 517main (int argc, char *const *argv)
514{ 518{
diff --git a/src/testcurl/test_get_empty.c b/src/testcurl/test_get_empty.c
index 0fffb37d..79ce49e8 100644
--- a/src/testcurl/test_get_empty.c
+++ b/src/testcurl/test_get_empty.c
@@ -170,7 +170,7 @@ testInternalGet (int poll_flag)
170 { 170 {
171 const union MHD_DaemonInfo *dinfo; 171 const union MHD_DaemonInfo *dinfo;
172 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 172 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
173 if ((NULL == dinfo) ||(0 == dinfo->port) ) 173 if ((NULL == dinfo) || (0 == dinfo->port) )
174 { 174 {
175 MHD_stop_daemon (d); return 32; 175 MHD_stop_daemon (d); return 32;
176 } 176 }
@@ -242,7 +242,7 @@ testMultithreadedGet (int poll_flag)
242 { 242 {
243 const union MHD_DaemonInfo *dinfo; 243 const union MHD_DaemonInfo *dinfo;
244 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 244 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
245 if ((NULL == dinfo) ||(0 == dinfo->port) ) 245 if ((NULL == dinfo) || (0 == dinfo->port) )
246 { 246 {
247 MHD_stop_daemon (d); return 32; 247 MHD_stop_daemon (d); return 32;
248 } 248 }
@@ -314,7 +314,7 @@ testMultithreadedPoolGet (int poll_flag)
314 { 314 {
315 const union MHD_DaemonInfo *dinfo; 315 const union MHD_DaemonInfo *dinfo;
316 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 316 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
317 if ((NULL == dinfo) ||(0 == dinfo->port) ) 317 if ((NULL == dinfo) || (0 == dinfo->port) )
318 { 318 {
319 MHD_stop_daemon (d); return 32; 319 MHD_stop_daemon (d); return 32;
320 } 320 }
@@ -395,7 +395,7 @@ testExternalGet ()
395 { 395 {
396 const union MHD_DaemonInfo *dinfo; 396 const union MHD_DaemonInfo *dinfo;
397 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 397 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
398 if ((NULL == dinfo) ||(0 == dinfo->port) ) 398 if ((NULL == dinfo) || (0 == dinfo->port) )
399 { 399 {
400 MHD_stop_daemon (d); return 32; 400 MHD_stop_daemon (d); return 32;
401 } 401 }
@@ -472,9 +472,10 @@ testExternalGet ()
472 if (EINTR != errno) 472 if (EINTR != errno)
473 abort (); 473 abort ();
474#else 474#else
475 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 475 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
476 ws.fd_count) 476 ws.
477 ||(0 != es.fd_count) ) 477 fd_count)
478 || (0 != es.fd_count) )
478 _exit (99); 479 _exit (99);
479 Sleep (1000); 480 Sleep (1000);
480#endif 481#endif
@@ -558,7 +559,7 @@ testUnknownPortGet (int poll_flag)
558 { 559 {
559 const union MHD_DaemonInfo *dinfo; 560 const union MHD_DaemonInfo *dinfo;
560 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 561 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
561 if ((NULL == dinfo) ||(0 == dinfo->port) ) 562 if ((NULL == dinfo) || (0 == dinfo->port) )
562 { 563 {
563 MHD_stop_daemon (d); return 32; 564 MHD_stop_daemon (d); return 32;
564 } 565 }
@@ -631,7 +632,7 @@ testStopRace (int poll_flag)
631 { 632 {
632 const union MHD_DaemonInfo *dinfo; 633 const union MHD_DaemonInfo *dinfo;
633 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 634 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
634 if ((NULL == dinfo) ||(0 == dinfo->port) ) 635 if ((NULL == dinfo) || (0 == dinfo->port) )
635 { 636 {
636 MHD_stop_daemon (d); return 32; 637 MHD_stop_daemon (d); return 32;
637 } 638 }
@@ -721,8 +722,8 @@ curlExcessFound (CURL *c, curl_infotype type, char *data, size_t size,
721 (void) c; /* Unused. Silent compiler warning. */ 722 (void) c; /* Unused. Silent compiler warning. */
722 723
723 if ((CURLINFO_TEXT == type) 724 if ((CURLINFO_TEXT == type)
724 &&(size >= str_size) 725 && (size >= str_size)
725 &&(0 == strncmp (excess_found, data, str_size))) 726 && (0 == strncmp (excess_found, data, str_size)))
726 *(int *) cls = 1; 727 *(int *) cls = 1;
727 return 0; 728 return 0;
728} 729}
@@ -761,7 +762,7 @@ testEmptyGet (int poll_flag)
761 { 762 {
762 const union MHD_DaemonInfo *dinfo; 763 const union MHD_DaemonInfo *dinfo;
763 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 764 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
764 if ((NULL == dinfo) ||(0 == dinfo->port) ) 765 if ((NULL == dinfo) || (0 == dinfo->port) )
765 { 766 {
766 MHD_stop_daemon (d); return 32; 767 MHD_stop_daemon (d); return 32;
767 } 768 }
@@ -812,7 +813,7 @@ main (int argc, char *const *argv)
812 unsigned int test_result = 0; 813 unsigned int test_result = 0;
813 int verbose = 0; 814 int verbose = 0;
814 815
815 if ((NULL == argv)||(0 == argv[0])) 816 if ((NULL == argv) || (0 == argv[0]))
816 return 99; 817 return 99;
817 oneone = has_in_name (argv[0], "11"); 818 oneone = has_in_name (argv[0], "11");
818 verbose = has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose"); 819 verbose = has_param (argc, argv, "-v") || has_param (argc, argv, "--verbose");
diff --git a/src/testcurl/test_get_response_cleanup.c b/src/testcurl/test_get_response_cleanup.c
index 04fe3204..14c2f240 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -180,7 +180,7 @@ testInternalGet ()
180 { 180 {
181 const union MHD_DaemonInfo *dinfo; 181 const union MHD_DaemonInfo *dinfo;
182 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 182 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
183 if ((NULL == dinfo) ||(0 == dinfo->port) ) 183 if ((NULL == dinfo) || (0 == dinfo->port) )
184 { 184 {
185 MHD_stop_daemon (d); return 32; 185 MHD_stop_daemon (d); return 32;
186 } 186 }
@@ -231,7 +231,7 @@ testMultithreadedGet ()
231 { 231 {
232 const union MHD_DaemonInfo *dinfo; 232 const union MHD_DaemonInfo *dinfo;
233 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 233 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
234 if ((NULL == dinfo) ||(0 == dinfo->port) ) 234 if ((NULL == dinfo) || (0 == dinfo->port) )
235 { 235 {
236 MHD_stop_daemon (d); return 32; 236 MHD_stop_daemon (d); return 32;
237 } 237 }
@@ -292,7 +292,7 @@ testMultithreadedPoolGet ()
292 { 292 {
293 const union MHD_DaemonInfo *dinfo; 293 const union MHD_DaemonInfo *dinfo;
294 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 294 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
295 if ((NULL == dinfo) ||(0 == dinfo->port) ) 295 if ((NULL == dinfo) || (0 == dinfo->port) )
296 { 296 {
297 MHD_stop_daemon (d); return 32; 297 MHD_stop_daemon (d); return 32;
298 } 298 }
@@ -346,7 +346,7 @@ testExternalGet ()
346 { 346 {
347 const union MHD_DaemonInfo *dinfo; 347 const union MHD_DaemonInfo *dinfo;
348 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 348 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
349 if ((NULL == dinfo) ||(0 == dinfo->port) ) 349 if ((NULL == dinfo) || (0 == dinfo->port) )
350 { 350 {
351 MHD_stop_daemon (d); return 32; 351 MHD_stop_daemon (d); return 32;
352 } 352 }
@@ -426,7 +426,7 @@ main (int argc, char *const *argv)
426 } 426 }
427#endif /* _WIN32 */ 427#endif /* _WIN32 */
428 428
429 if ((NULL == argv)||(0 == argv[0])) 429 if ((NULL == argv) || (0 == argv[0]))
430 return 99; 430 return 99;
431 oneone = has_in_name (argv[0], "11"); 431 oneone = has_in_name (argv[0], "11");
432 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) 432 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index 7651ff56..d2913e67 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -147,7 +147,7 @@ testInternalGet ()
147 { 147 {
148 const union MHD_DaemonInfo *dinfo; 148 const union MHD_DaemonInfo *dinfo;
149 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 149 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
150 if ((NULL == dinfo) ||(0 == dinfo->port) ) 150 if ((NULL == dinfo) || (0 == dinfo->port) )
151 { 151 {
152 MHD_stop_daemon (d); return 32; 152 MHD_stop_daemon (d); return 32;
153 } 153 }
@@ -219,7 +219,7 @@ testMultithreadedGet ()
219 { 219 {
220 const union MHD_DaemonInfo *dinfo; 220 const union MHD_DaemonInfo *dinfo;
221 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 221 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
222 if ((NULL == dinfo) ||(0 == dinfo->port) ) 222 if ((NULL == dinfo) || (0 == dinfo->port) )
223 { 223 {
224 MHD_stop_daemon (d); return 32; 224 MHD_stop_daemon (d); return 32;
225 } 225 }
@@ -291,7 +291,7 @@ testMultithreadedPoolGet ()
291 { 291 {
292 const union MHD_DaemonInfo *dinfo; 292 const union MHD_DaemonInfo *dinfo;
293 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 293 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
294 if ((NULL == dinfo) ||(0 == dinfo->port) ) 294 if ((NULL == dinfo) || (0 == dinfo->port) )
295 { 295 {
296 MHD_stop_daemon (d); return 32; 296 MHD_stop_daemon (d); return 32;
297 } 297 }
@@ -377,7 +377,7 @@ testExternalGet ()
377 { 377 {
378 const union MHD_DaemonInfo *dinfo; 378 const union MHD_DaemonInfo *dinfo;
379 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 379 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
380 if ((NULL == dinfo) ||(0 == dinfo->port) ) 380 if ((NULL == dinfo) || (0 == dinfo->port) )
381 { 381 {
382 MHD_stop_daemon (d); return 32; 382 MHD_stop_daemon (d); return 32;
383 } 383 }
@@ -450,9 +450,10 @@ testExternalGet ()
450 if (EINTR != errno) 450 if (EINTR != errno)
451 abort (); 451 abort ();
452#else 452#else
453 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 453 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
454 ws.fd_count) 454 ws.
455 ||(0 != es.fd_count) ) 455 fd_count)
456 || (0 != es.fd_count) )
456 abort (); 457 abort ();
457 Sleep (1000); 458 Sleep (1000);
458#endif 459#endif
@@ -539,7 +540,7 @@ testUnknownPortGet ()
539 { 540 {
540 const union MHD_DaemonInfo *dinfo; 541 const union MHD_DaemonInfo *dinfo;
541 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 542 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
542 if ((NULL == dinfo) ||(0 == dinfo->port) ) 543 if ((NULL == dinfo) || (0 == dinfo->port) )
543 { 544 {
544 MHD_stop_daemon (d); return 32; 545 MHD_stop_daemon (d); return 32;
545 } 546 }
@@ -591,7 +592,7 @@ main (int argc, char *const *argv)
591 FILE *f; 592 FILE *f;
592 (void) argc; /* Unused. Silent compiler warning. */ 593 (void) argc; /* Unused. Silent compiler warning. */
593 594
594 if ((NULL == argv)||(0 == argv[0])) 595 if ((NULL == argv) || (0 == argv[0]))
595 return 99; 596 return 99;
596 oneone = has_in_name (argv[0], "11"); 597 oneone = has_in_name (argv[0], "11");
597 598
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c
index 82d2923f..60570886 100644
--- a/src/testcurl/test_iplimit.c
+++ b/src/testcurl/test_iplimit.c
@@ -73,6 +73,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
73 return size * nmemb; 73 return size * nmemb;
74} 74}
75 75
76
76static int 77static int
77ahc_echo (void *cls, 78ahc_echo (void *cls,
78 struct MHD_Connection *connection, 79 struct MHD_Connection *connection,
@@ -106,6 +107,7 @@ ahc_echo (void *cls,
106 return ret; 107 return ret;
107} 108}
108 109
110
109static int 111static int
110testMultithreadedGet () 112testMultithreadedGet ()
111{ 113{
@@ -140,7 +142,7 @@ testMultithreadedGet ()
140 { 142 {
141 const union MHD_DaemonInfo *dinfo; 143 const union MHD_DaemonInfo *dinfo;
142 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 144 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
143 if ((NULL == dinfo) ||(0 == dinfo->port) ) 145 if ((NULL == dinfo) || (0 == dinfo->port) )
144 { 146 {
145 MHD_stop_daemon (d); return 32; 147 MHD_stop_daemon (d); return 32;
146 } 148 }
@@ -220,6 +222,7 @@ testMultithreadedGet ()
220 return 0; 222 return 0;
221} 223}
222 224
225
223static int 226static int
224testMultithreadedPoolGet () 227testMultithreadedPoolGet ()
225{ 228{
@@ -251,7 +254,7 @@ testMultithreadedPoolGet ()
251 { 254 {
252 const union MHD_DaemonInfo *dinfo; 255 const union MHD_DaemonInfo *dinfo;
253 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 256 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
254 if ((NULL == dinfo) ||(0 == dinfo->port) ) 257 if ((NULL == dinfo) || (0 == dinfo->port) )
255 { 258 {
256 MHD_stop_daemon (d); return 32; 259 MHD_stop_daemon (d); return 32;
257 } 260 }
@@ -338,13 +341,14 @@ testMultithreadedPoolGet ()
338 return 0; 341 return 0;
339} 342}
340 343
344
341int 345int
342main (int argc, char *const *argv) 346main (int argc, char *const *argv)
343{ 347{
344 unsigned int errorCount = 0; 348 unsigned int errorCount = 0;
345 (void) argc; /* Unused. Silent compiler warning. */ 349 (void) argc; /* Unused. Silent compiler warning. */
346 350
347 if ((NULL == argv)||(0 == argv[0])) 351 if ((NULL == argv) || (0 == argv[0]))
348 return 99; 352 return 99;
349 oneone = has_in_name (argv[0], "11"); 353 oneone = has_in_name (argv[0], "11");
350 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 354 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index 0b7256ae..b52246ef 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -86,6 +86,7 @@ alloc_init (size_t buf_size)
86 return buf; 86 return buf;
87} 87}
88 88
89
89static size_t 90static size_t
90putBuffer (void *stream, size_t size, size_t nmemb, void *ptr) 91putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
91{ 92{
@@ -103,6 +104,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
103 return wrt; 104 return wrt;
104} 105}
105 106
107
106static size_t 108static size_t
107copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 109copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
108{ 110{
@@ -115,6 +117,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
115 return size * nmemb; 117 return size * nmemb;
116} 118}
117 119
120
118static int 121static int
119ahc_echo (void *cls, 122ahc_echo (void *cls,
120 struct MHD_Connection *connection, 123 struct MHD_Connection *connection,
@@ -213,7 +216,7 @@ testPutInternalThread (unsigned int add_flag)
213 { 216 {
214 const union MHD_DaemonInfo *dinfo; 217 const union MHD_DaemonInfo *dinfo;
215 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 218 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
216 if ((NULL == dinfo) ||(0 == dinfo->port) ) 219 if ((NULL == dinfo) || (0 == dinfo->port) )
217 { 220 {
218 MHD_stop_daemon (d); return 32; 221 MHD_stop_daemon (d); return 32;
219 } 222 }
@@ -257,6 +260,7 @@ testPutInternalThread (unsigned int add_flag)
257 return 0; 260 return 0;
258} 261}
259 262
263
260static int 264static int
261testPutThreadPerConn (unsigned int add_flag) 265testPutThreadPerConn (unsigned int add_flag)
262{ 266{
@@ -297,7 +301,7 @@ testPutThreadPerConn (unsigned int add_flag)
297 { 301 {
298 const union MHD_DaemonInfo *dinfo; 302 const union MHD_DaemonInfo *dinfo;
299 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 303 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
300 if ((NULL == dinfo) ||(0 == dinfo->port) ) 304 if ((NULL == dinfo) || (0 == dinfo->port) )
301 { 305 {
302 MHD_stop_daemon (d); return 32; 306 MHD_stop_daemon (d); return 32;
303 } 307 }
@@ -344,6 +348,7 @@ testPutThreadPerConn (unsigned int add_flag)
344 return 0; 348 return 0;
345} 349}
346 350
351
347static int 352static int
348testPutThreadPool (unsigned int add_flag) 353testPutThreadPool (unsigned int add_flag)
349{ 354{
@@ -384,7 +389,7 @@ testPutThreadPool (unsigned int add_flag)
384 { 389 {
385 const union MHD_DaemonInfo *dinfo; 390 const union MHD_DaemonInfo *dinfo;
386 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 391 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
387 if ((NULL == dinfo) ||(0 == dinfo->port) ) 392 if ((NULL == dinfo) || (0 == dinfo->port) )
388 { 393 {
389 MHD_stop_daemon (d); return 32; 394 MHD_stop_daemon (d); return 32;
390 } 395 }
@@ -431,6 +436,7 @@ testPutThreadPool (unsigned int add_flag)
431 return 0; 436 return 0;
432} 437}
433 438
439
434static int 440static int
435testPutExternal (void) 441testPutExternal (void)
436{ 442{
@@ -484,7 +490,7 @@ testPutExternal (void)
484 { 490 {
485 const union MHD_DaemonInfo *dinfo; 491 const union MHD_DaemonInfo *dinfo;
486 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 492 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
487 if ((NULL == dinfo) ||(0 == dinfo->port) ) 493 if ((NULL == dinfo) || (0 == dinfo->port) )
488 { 494 {
489 MHD_stop_daemon (d); return 32; 495 MHD_stop_daemon (d); return 32;
490 } 496 }
@@ -561,9 +567,10 @@ testPutExternal (void)
561 if (EINTR != errno) 567 if (EINTR != errno)
562 abort (); 568 abort ();
563#else 569#else
564 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 570 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
565 ws.fd_count) 571 ws.
566 ||(0 != es.fd_count) ) 572 fd_count)
573 || (0 != es.fd_count) )
567 abort (); 574 abort ();
568 Sleep (1000); 575 Sleep (1000);
569#endif 576#endif
@@ -608,7 +615,6 @@ testPutExternal (void)
608} 615}
609 616
610 617
611
612int 618int
613main (int argc, char *const *argv) 619main (int argc, char *const *argv)
614{ 620{
@@ -624,40 +630,40 @@ main (int argc, char *const *argv)
624 if (NULL == put_buffer) 630 if (NULL == put_buffer)
625 return 99; 631 return 99;
626 lastErr = testPutExternal (); 632 lastErr = testPutExternal ();
627 if (verbose &&(0 != lastErr)) 633 if (verbose && (0 != lastErr))
628 fprintf (stderr, "Error during testing with external select().\n"); 634 fprintf (stderr, "Error during testing with external select().\n");
629 errorCount += lastErr; 635 errorCount += lastErr;
630 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) 636 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
631 { 637 {
632 lastErr = testPutInternalThread (0); 638 lastErr = testPutInternalThread (0);
633 if (verbose &&(0 != lastErr) ) 639 if (verbose && (0 != lastErr) )
634 fprintf (stderr, 640 fprintf (stderr,
635 "Error during testing with internal thread with select().\n"); 641 "Error during testing with internal thread with select().\n");
636 errorCount += lastErr; 642 errorCount += lastErr;
637 lastErr = testPutThreadPerConn (0); 643 lastErr = testPutThreadPerConn (0);
638 if (verbose &&(0 != lastErr) ) 644 if (verbose && (0 != lastErr) )
639 fprintf (stderr, 645 fprintf (stderr,
640 "Error during testing with internal thread per connection with select().\n"); 646 "Error during testing with internal thread per connection with select().\n");
641 errorCount += lastErr; 647 errorCount += lastErr;
642 lastErr = testPutThreadPool (0); 648 lastErr = testPutThreadPool (0);
643 if (verbose &&(0 != lastErr) ) 649 if (verbose && (0 != lastErr) )
644 fprintf (stderr, 650 fprintf (stderr,
645 "Error during testing with thread pool per connection with select().\n"); 651 "Error during testing with thread pool per connection with select().\n");
646 errorCount += lastErr; 652 errorCount += lastErr;
647 if (MHD_is_feature_supported (MHD_FEATURE_POLL)) 653 if (MHD_is_feature_supported (MHD_FEATURE_POLL))
648 { 654 {
649 lastErr = testPutInternalThread (MHD_USE_POLL); 655 lastErr = testPutInternalThread (MHD_USE_POLL);
650 if (verbose &&(0 != lastErr) ) 656 if (verbose && (0 != lastErr) )
651 fprintf (stderr, 657 fprintf (stderr,
652 "Error during testing with internal thread with poll().\n"); 658 "Error during testing with internal thread with poll().\n");
653 errorCount += lastErr; 659 errorCount += lastErr;
654 lastErr = testPutThreadPerConn (MHD_USE_POLL); 660 lastErr = testPutThreadPerConn (MHD_USE_POLL);
655 if (verbose &&(0 != lastErr) ) 661 if (verbose && (0 != lastErr) )
656 fprintf (stderr, 662 fprintf (stderr,
657 "Error during testing with internal thread per connection with poll().\n"); 663 "Error during testing with internal thread per connection with poll().\n");
658 errorCount += lastErr; 664 errorCount += lastErr;
659 lastErr = testPutThreadPool (MHD_USE_POLL); 665 lastErr = testPutThreadPool (MHD_USE_POLL);
660 if (verbose &&(0 != lastErr) ) 666 if (verbose && (0 != lastErr) )
661 fprintf (stderr, 667 fprintf (stderr,
662 "Error during testing with thread pool per connection with poll().\n"); 668 "Error during testing with thread pool per connection with poll().\n");
663 errorCount += lastErr; 669 errorCount += lastErr;
@@ -665,12 +671,12 @@ main (int argc, char *const *argv)
665 if (MHD_is_feature_supported (MHD_FEATURE_EPOLL)) 671 if (MHD_is_feature_supported (MHD_FEATURE_EPOLL))
666 { 672 {
667 lastErr = testPutInternalThread (MHD_USE_EPOLL); 673 lastErr = testPutInternalThread (MHD_USE_EPOLL);
668 if (verbose &&(0 != lastErr) ) 674 if (verbose && (0 != lastErr) )
669 fprintf (stderr, 675 fprintf (stderr,
670 "Error during testing with internal thread with epoll.\n"); 676 "Error during testing with internal thread with epoll.\n");
671 errorCount += lastErr; 677 errorCount += lastErr;
672 lastErr = testPutThreadPool (MHD_USE_EPOLL); 678 lastErr = testPutThreadPool (MHD_USE_EPOLL);
673 if (verbose &&(0 != lastErr) ) 679 if (verbose && (0 != lastErr) )
674 fprintf (stderr, 680 fprintf (stderr,
675 "Error during testing with thread pool per connection with epoll.\n"); 681 "Error during testing with thread pool per connection with epoll.\n");
676 errorCount += lastErr; 682 errorCount += lastErr;
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index 01d62d11..17d8904b 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -53,6 +53,7 @@ apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen)
53 return MHD_YES; 53 return MHD_YES;
54} 54}
55 55
56
56struct CBC 57struct CBC
57{ 58{
58 char *buf; 59 char *buf;
@@ -67,6 +68,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
67 return size * nmemb; 68 return size * nmemb;
68} 69}
69 70
71
70static int 72static int
71ahc_echo (void *cls, 73ahc_echo (void *cls,
72 struct MHD_Connection *connection, 74 struct MHD_Connection *connection,
@@ -130,7 +132,7 @@ testLongUrlGet (size_t buff_size)
130 { 132 {
131 const union MHD_DaemonInfo *dinfo; 133 const union MHD_DaemonInfo *dinfo;
132 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 134 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
133 if ((NULL == dinfo) ||(0 == dinfo->port) ) 135 if ((NULL == dinfo) || (0 == dinfo->port) )
134 { 136 {
135 MHD_stop_daemon (d); return 32; 137 MHD_stop_daemon (d); return 32;
136 } 138 }
@@ -223,7 +225,7 @@ testLongHeaderGet (size_t buff_size)
223 { 225 {
224 const union MHD_DaemonInfo *dinfo; 226 const union MHD_DaemonInfo *dinfo;
225 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 227 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
226 if ((NULL == dinfo) ||(0 == dinfo->port) ) 228 if ((NULL == dinfo) || (0 == dinfo->port) )
227 { 229 {
228 MHD_stop_daemon (d); return 32; 230 MHD_stop_daemon (d); return 32;
229 } 231 }
@@ -283,13 +285,14 @@ testLongHeaderGet (size_t buff_size)
283 return 0; 285 return 0;
284} 286}
285 287
288
286int 289int
287main (int argc, char *const *argv) 290main (int argc, char *const *argv)
288{ 291{
289 unsigned int errorCount = 0; 292 unsigned int errorCount = 0;
290 (void) argc; /* Unused. Silent compiler warning. */ 293 (void) argc; /* Unused. Silent compiler warning. */
291 294
292 if ((NULL == argv)||(0 == argv[0])) 295 if ((NULL == argv) || (0 == argv[0]))
293 return 99; 296 return 99;
294 oneone = has_in_name (argv[0], "11"); 297 oneone = has_in_name (argv[0], "11");
295 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 298 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c
index da33ea3f..d4c291ea 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -58,6 +58,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
58 return size * nmemb; 58 return size * nmemb;
59} 59}
60 60
61
61static int 62static int
62ahc_echo (void *cls, 63ahc_echo (void *cls,
63 struct MHD_Connection *connection, 64 struct MHD_Connection *connection,
@@ -105,6 +106,7 @@ ahc_echo (void *cls,
105 return ret; 106 return ret;
106} 107}
107 108
109
108static int 110static int
109testExternalGet () 111testExternalGet ()
110{ 112{
@@ -150,7 +152,7 @@ testExternalGet ()
150 { 152 {
151 const union MHD_DaemonInfo *dinfo; 153 const union MHD_DaemonInfo *dinfo;
152 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 154 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
153 if ((NULL == dinfo) ||(0 == dinfo->port) ) 155 if ((NULL == dinfo) || (0 == dinfo->port) )
154 { 156 {
155 MHD_stop_daemon (d); return 32; 157 MHD_stop_daemon (d); return 32;
156 } 158 }
@@ -228,9 +230,10 @@ testExternalGet ()
228 if (EINTR != errno) 230 if (EINTR != errno)
229 abort (); 231 abort ();
230#else 232#else
231 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 233 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
232 ws.fd_count) 234 ws.
233 ||(0 != es.fd_count) ) 235 fd_count)
236 || (0 != es.fd_count) )
234 abort (); 237 abort ();
235 Sleep (1000); 238 Sleep (1000);
236#endif 239#endif
@@ -278,7 +281,7 @@ main (int argc, char *const *argv)
278 unsigned int errorCount = 0; 281 unsigned int errorCount = 0;
279 (void) argc; /* Unused. Silent compiler warning. */ 282 (void) argc; /* Unused. Silent compiler warning. */
280 283
281 if ((NULL == argv)||(0 == argv[0])) 284 if ((NULL == argv) || (0 == argv[0]))
282 return 99; 285 return 99;
283 oneone = has_in_name (argv[0], "11"); 286 oneone = has_in_name (argv[0], "11");
284 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 287 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index b665139a..97c9bcc9 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -196,7 +196,7 @@ testInternalPost ()
196 { 196 {
197 const union MHD_DaemonInfo *dinfo; 197 const union MHD_DaemonInfo *dinfo;
198 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 198 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
199 if ((NULL == dinfo) ||(0 == dinfo->port) ) 199 if ((NULL == dinfo) || (0 == dinfo->port) )
200 { 200 {
201 MHD_stop_daemon (d); return 32; 201 MHD_stop_daemon (d); return 32;
202 } 202 }
@@ -239,6 +239,7 @@ testInternalPost ()
239 return 0; 239 return 0;
240} 240}
241 241
242
242static int 243static int
243testMultithreadedPost () 244testMultithreadedPost ()
244{ 245{
@@ -272,7 +273,7 @@ testMultithreadedPost ()
272 { 273 {
273 const union MHD_DaemonInfo *dinfo; 274 const union MHD_DaemonInfo *dinfo;
274 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 275 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
275 if ((NULL == dinfo) ||(0 == dinfo->port) ) 276 if ((NULL == dinfo) || (0 == dinfo->port) )
276 { 277 {
277 MHD_stop_daemon (d); return 32; 278 MHD_stop_daemon (d); return 32;
278 } 279 }
@@ -315,6 +316,7 @@ testMultithreadedPost ()
315 return 0; 316 return 0;
316} 317}
317 318
319
318static int 320static int
319testMultithreadedPoolPost () 321testMultithreadedPoolPost ()
320{ 322{
@@ -348,7 +350,7 @@ testMultithreadedPoolPost ()
348 { 350 {
349 const union MHD_DaemonInfo *dinfo; 351 const union MHD_DaemonInfo *dinfo;
350 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 352 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
351 if ((NULL == dinfo) ||(0 == dinfo->port) ) 353 if ((NULL == dinfo) || (0 == dinfo->port) )
352 { 354 {
353 MHD_stop_daemon (d); return 32; 355 MHD_stop_daemon (d); return 32;
354 } 356 }
@@ -391,6 +393,7 @@ testMultithreadedPoolPost ()
391 return 0; 393 return 0;
392} 394}
393 395
396
394static int 397static int
395testExternalPost () 398testExternalPost ()
396{ 399{
@@ -438,7 +441,7 @@ testExternalPost ()
438 { 441 {
439 const union MHD_DaemonInfo *dinfo; 442 const union MHD_DaemonInfo *dinfo;
440 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 443 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
441 if ((NULL == dinfo) ||(0 == dinfo->port) ) 444 if ((NULL == dinfo) || (0 == dinfo->port) )
442 { 445 {
443 MHD_stop_daemon (d); return 32; 446 MHD_stop_daemon (d); return 32;
444 } 447 }
@@ -514,9 +517,10 @@ testExternalPost ()
514 if (EINTR != errno) 517 if (EINTR != errno)
515 abort (); 518 abort ();
516#else 519#else
517 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 520 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
518 ws.fd_count) 521 ws.
519 ||(0 != es.fd_count) ) 522 fd_count)
523 || (0 != es.fd_count) )
520 abort (); 524 abort ();
521 Sleep (1000); 525 Sleep (1000);
522#endif 526#endif
@@ -599,6 +603,7 @@ ahc_cancel (void *cls,
599 } 603 }
600} 604}
601 605
606
602struct CRBC 607struct CRBC
603{ 608{
604 const char *buffer; 609 const char *buffer;
@@ -681,7 +686,7 @@ testMultithreadedPostCancelPart (int flags)
681 { 686 {
682 const union MHD_DaemonInfo *dinfo; 687 const union MHD_DaemonInfo *dinfo;
683 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 688 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
684 if ((NULL == dinfo) ||(0 == dinfo->port) ) 689 if ((NULL == dinfo) || (0 == dinfo->port) )
685 { 690 {
686 MHD_stop_daemon (d); return 32; 691 MHD_stop_daemon (d); return 32;
687 } 692 }
@@ -728,8 +733,8 @@ testMultithreadedPostCancelPart (int flags)
728 { 733 {
729#ifdef _WIN32 734#ifdef _WIN32
730 curl_version_info_data *curlverd = curl_version_info (CURLVERSION_NOW); 735 curl_version_info_data *curlverd = curl_version_info (CURLVERSION_NOW);
731 if ((0 != (flags & FLAG_SLOW_READ)) &&(CURLE_RECV_ERROR == errornum) && 736 if ((0 != (flags & FLAG_SLOW_READ)) && (CURLE_RECV_ERROR == errornum) &&
732 ((curlverd == NULL) ||(curlverd->ares_num < 0x073100) ) ) 737 ((curlverd == NULL) || (curlverd->ares_num < 0x073100) ) )
733 { /* libcurl up to version 7.49.0 didn't have workaround for WinSock bug */ 738 { /* libcurl up to version 7.49.0 didn't have workaround for WinSock bug */
734 fprintf (stderr, 739 fprintf (stderr,
735 "Ignored curl_easy_perform expected failure on W32 with \"slow read\".\n"); 740 "Ignored curl_easy_perform expected failure on W32 with \"slow read\".\n");
@@ -792,7 +797,7 @@ main (int argc, char *const *argv)
792 unsigned int errorCount = 0; 797 unsigned int errorCount = 0;
793 (void) argc; /* Unused. Silent compiler warning. */ 798 (void) argc; /* Unused. Silent compiler warning. */
794 799
795 if ((NULL == argv)||(0 == argv[0])) 800 if ((NULL == argv) || (0 == argv[0]))
796 return 99; 801 return 99;
797 oneone = has_in_name (argv[0], "11"); 802 oneone = has_in_name (argv[0], "11");
798 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 803 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index 558228a2..38f9de6e 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -71,6 +71,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
71 return size * nmemb; 71 return size * nmemb;
72} 72}
73 73
74
74static int 75static int
75ahc_echo (void *cls, 76ahc_echo (void *cls,
76 struct MHD_Connection *connection, 77 struct MHD_Connection *connection,
@@ -141,7 +142,7 @@ testInternalPost ()
141 { 142 {
142 const union MHD_DaemonInfo *dinfo; 143 const union MHD_DaemonInfo *dinfo;
143 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 144 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
144 if ((NULL == dinfo) ||(0 == dinfo->port) ) 145 if ((NULL == dinfo) || (0 == dinfo->port) )
145 { 146 {
146 MHD_stop_daemon (d); return 32; 147 MHD_stop_daemon (d); return 32;
147 } 148 }
@@ -198,6 +199,7 @@ testInternalPost ()
198 return 0; 199 return 0;
199} 200}
200 201
202
201static int 203static int
202testMultithreadedPost () 204testMultithreadedPost ()
203{ 205{
@@ -232,7 +234,7 @@ testMultithreadedPost ()
232 { 234 {
233 const union MHD_DaemonInfo *dinfo; 235 const union MHD_DaemonInfo *dinfo;
234 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 236 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
235 if ((NULL == dinfo) ||(0 == dinfo->port) ) 237 if ((NULL == dinfo) || (0 == dinfo->port) )
236 { 238 {
237 MHD_stop_daemon (d); return 32; 239 MHD_stop_daemon (d); return 32;
238 } 240 }
@@ -289,6 +291,7 @@ testMultithreadedPost ()
289 return 0; 291 return 0;
290} 292}
291 293
294
292static int 295static int
293testMultithreadedPoolPost () 296testMultithreadedPoolPost ()
294{ 297{
@@ -321,7 +324,7 @@ testMultithreadedPoolPost ()
321 { 324 {
322 const union MHD_DaemonInfo *dinfo; 325 const union MHD_DaemonInfo *dinfo;
323 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 326 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
324 if ((NULL == dinfo) ||(0 == dinfo->port) ) 327 if ((NULL == dinfo) || (0 == dinfo->port) )
325 { 328 {
326 MHD_stop_daemon (d); return 32; 329 MHD_stop_daemon (d); return 32;
327 } 330 }
@@ -378,6 +381,7 @@ testMultithreadedPoolPost ()
378 return 0; 381 return 0;
379} 382}
380 383
384
381static int 385static int
382testExternalPost () 386testExternalPost ()
383{ 387{
@@ -427,7 +431,7 @@ testExternalPost ()
427 { 431 {
428 const union MHD_DaemonInfo *dinfo; 432 const union MHD_DaemonInfo *dinfo;
429 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 433 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
430 if ((NULL == dinfo) ||(0 == dinfo->port) ) 434 if ((NULL == dinfo) || (0 == dinfo->port) )
431 { 435 {
432 MHD_stop_daemon (d); return 32; 436 MHD_stop_daemon (d); return 32;
433 } 437 }
@@ -592,7 +596,7 @@ main (int argc, char *const *argv)
592 unsigned int errorCount = 0; 596 unsigned int errorCount = 0;
593 (void) argc; /* Unused. Silent compiler warning. */ 597 (void) argc; /* Unused. Silent compiler warning. */
594 598
595 if ((NULL == argv)||(0 == argv[0])) 599 if ((NULL == argv) || (0 == argv[0]))
596 return 99; 600 return 99;
597 oneone = has_in_name (argv[0], "11"); 601 oneone = has_in_name (argv[0], "11");
598 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 602 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index c4fbd5d5..25e6d0e4 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -164,6 +164,7 @@ ahc_echo (void *cls,
164 return MHD_YES; 164 return MHD_YES;
165} 165}
166 166
167
167static struct curl_httppost * 168static struct curl_httppost *
168make_form () 169make_form ()
169{ 170{
@@ -211,7 +212,7 @@ testInternalPost ()
211 { 212 {
212 const union MHD_DaemonInfo *dinfo; 213 const union MHD_DaemonInfo *dinfo;
213 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 214 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
214 if ((NULL == dinfo) ||(0 == dinfo->port) ) 215 if ((NULL == dinfo) || (0 == dinfo->port) )
215 { 216 {
216 MHD_stop_daemon (d); return 32; 217 MHD_stop_daemon (d); return 32;
217 } 218 }
@@ -255,6 +256,7 @@ testInternalPost ()
255 return 0; 256 return 0;
256} 257}
257 258
259
258static int 260static int
259testMultithreadedPost () 261testMultithreadedPost ()
260{ 262{
@@ -289,7 +291,7 @@ testMultithreadedPost ()
289 { 291 {
290 const union MHD_DaemonInfo *dinfo; 292 const union MHD_DaemonInfo *dinfo;
291 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 293 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
292 if ((NULL == dinfo) ||(0 == dinfo->port) ) 294 if ((NULL == dinfo) || (0 == dinfo->port) )
293 { 295 {
294 MHD_stop_daemon (d); return 32; 296 MHD_stop_daemon (d); return 32;
295 } 297 }
@@ -333,6 +335,7 @@ testMultithreadedPost ()
333 return 0; 335 return 0;
334} 336}
335 337
338
336static int 339static int
337testMultithreadedPoolPost () 340testMultithreadedPoolPost ()
338{ 341{
@@ -367,7 +370,7 @@ testMultithreadedPoolPost ()
367 { 370 {
368 const union MHD_DaemonInfo *dinfo; 371 const union MHD_DaemonInfo *dinfo;
369 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 372 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
370 if ((NULL == dinfo) ||(0 == dinfo->port) ) 373 if ((NULL == dinfo) || (0 == dinfo->port) )
371 { 374 {
372 MHD_stop_daemon (d); return 32; 375 MHD_stop_daemon (d); return 32;
373 } 376 }
@@ -411,6 +414,7 @@ testMultithreadedPoolPost ()
411 return 0; 414 return 0;
412} 415}
413 416
417
414static int 418static int
415testExternalPost () 419testExternalPost ()
416{ 420{
@@ -459,7 +463,7 @@ testExternalPost ()
459 { 463 {
460 const union MHD_DaemonInfo *dinfo; 464 const union MHD_DaemonInfo *dinfo;
461 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 465 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
462 if ((NULL == dinfo) ||(0 == dinfo->port) ) 466 if ((NULL == dinfo) || (0 == dinfo->port) )
463 { 467 {
464 MHD_stop_daemon (d); return 32; 468 MHD_stop_daemon (d); return 32;
465 } 469 }
@@ -538,9 +542,10 @@ testExternalPost ()
538 if (EINTR != errno) 542 if (EINTR != errno)
539 abort (); 543 abort ();
540#else 544#else
541 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 545 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
542 ws.fd_count) 546 ws.
543 ||(0 != es.fd_count) ) 547 fd_count)
548 || (0 != es.fd_count) )
544 abort (); 549 abort ();
545 Sleep (1000); 550 Sleep (1000);
546#endif 551#endif
@@ -598,7 +603,7 @@ main (int argc, char *const *argv)
598#endif 603#endif
599#endif 604#endif
600#endif /* MHD_HTTPS_REQUIRE_GRYPT */ 605#endif /* MHD_HTTPS_REQUIRE_GRYPT */
601 if ((NULL == argv)||(0 == argv[0])) 606 if ((NULL == argv) || (0 == argv[0]))
602 return 99; 607 return 99;
603 oneone = has_in_name (argv[0], "11"); 608 oneone = has_in_name (argv[0], "11");
604 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 609 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_process_arguments.c b/src/testcurl/test_process_arguments.c
index 3094a97f..dc50396d 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -155,7 +155,7 @@ testExternalGet ()
155 { 155 {
156 const union MHD_DaemonInfo *dinfo; 156 const union MHD_DaemonInfo *dinfo;
157 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 157 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
158 if ((NULL == dinfo) ||(0 == dinfo->port) ) 158 if ((NULL == dinfo) || (0 == dinfo->port) )
159 { 159 {
160 MHD_stop_daemon (d); return 32; 160 MHD_stop_daemon (d); return 32;
161 } 161 }
@@ -229,9 +229,10 @@ testExternalGet ()
229 if (EINTR != errno) 229 if (EINTR != errno)
230 abort (); 230 abort ();
231#else 231#else
232 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 232 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
233 ws.fd_count) 233 ws.
234 ||(0 != es.fd_count) ) 234 fd_count)
235 || (0 != es.fd_count) )
235 abort (); 236 abort ();
236 Sleep (1000); 237 Sleep (1000);
237#endif 238#endif
@@ -279,7 +280,7 @@ main (int argc, char *const *argv)
279 unsigned int errorCount = 0; 280 unsigned int errorCount = 0;
280 (void) argc; /* Unused. Silent compiler warning. */ 281 (void) argc; /* Unused. Silent compiler warning. */
281 282
282 if ((NULL == argv)||(0 == argv[0])) 283 if ((NULL == argv) || (0 == argv[0]))
283 return 99; 284 return 99;
284 oneone = has_in_name (argv[0], "11"); 285 oneone = has_in_name (argv[0], "11");
285 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 286 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_process_headers.c b/src/testcurl/test_process_headers.c
index a2d7485b..34200082 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -65,6 +65,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
65 return size * nmemb; 65 return size * nmemb;
66} 66}
67 67
68
68static int 69static int
69kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value) 70kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
70{ 71{
@@ -78,6 +79,7 @@ kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
78 return MHD_YES; 79 return MHD_YES;
79} 80}
80 81
82
81static int 83static int
82ahc_echo (void *cls, 84ahc_echo (void *cls,
83 struct MHD_Connection *connection, 85 struct MHD_Connection *connection,
@@ -179,7 +181,7 @@ testInternalGet ()
179 { 181 {
180 const union MHD_DaemonInfo *dinfo; 182 const union MHD_DaemonInfo *dinfo;
181 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 183 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
182 if ((NULL == dinfo) ||(0 == dinfo->port) ) 184 if ((NULL == dinfo) || (0 == dinfo->port) )
183 { 185 {
184 MHD_stop_daemon (d); return 32; 186 MHD_stop_daemon (d); return 32;
185 } 187 }
@@ -219,6 +221,7 @@ testInternalGet ()
219 return 0; 221 return 0;
220} 222}
221 223
224
222static int 225static int
223testMultithreadedGet () 226testMultithreadedGet ()
224{ 227{
@@ -250,7 +253,7 @@ testMultithreadedGet ()
250 { 253 {
251 const union MHD_DaemonInfo *dinfo; 254 const union MHD_DaemonInfo *dinfo;
252 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 255 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
253 if ((NULL == dinfo) ||(0 == dinfo->port) ) 256 if ((NULL == dinfo) || (0 == dinfo->port) )
254 { 257 {
255 MHD_stop_daemon (d); return 32; 258 MHD_stop_daemon (d); return 32;
256 } 259 }
@@ -290,6 +293,7 @@ testMultithreadedGet ()
290 return 0; 293 return 0;
291} 294}
292 295
296
293static int 297static int
294testMultithreadedPoolGet () 298testMultithreadedPoolGet ()
295{ 299{
@@ -321,7 +325,7 @@ testMultithreadedPoolGet ()
321 { 325 {
322 const union MHD_DaemonInfo *dinfo; 326 const union MHD_DaemonInfo *dinfo;
323 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 327 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
324 if ((NULL == dinfo) ||(0 == dinfo->port) ) 328 if ((NULL == dinfo) || (0 == dinfo->port) )
325 { 329 {
326 MHD_stop_daemon (d); return 32; 330 MHD_stop_daemon (d); return 32;
327 } 331 }
@@ -361,6 +365,7 @@ testMultithreadedPoolGet ()
361 return 0; 365 return 0;
362} 366}
363 367
368
364static int 369static int
365testExternalGet () 370testExternalGet ()
366{ 371{
@@ -406,7 +411,7 @@ testExternalGet ()
406 { 411 {
407 const union MHD_DaemonInfo *dinfo; 412 const union MHD_DaemonInfo *dinfo;
408 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 413 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
409 if ((NULL == dinfo) ||(0 == dinfo->port) ) 414 if ((NULL == dinfo) || (0 == dinfo->port) )
410 { 415 {
411 MHD_stop_daemon (d); return 32; 416 MHD_stop_daemon (d); return 32;
412 } 417 }
@@ -479,9 +484,10 @@ testExternalGet ()
479 if (EINTR != errno) 484 if (EINTR != errno)
480 abort (); 485 abort ();
481#else 486#else
482 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 487 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
483 ws.fd_count) 488 ws.
484 ||(0 != es.fd_count) ) 489 fd_count)
490 || (0 != es.fd_count) )
485 abort (); 491 abort ();
486 Sleep (1000); 492 Sleep (1000);
487#endif 493#endif
@@ -523,14 +529,13 @@ testExternalGet ()
523} 529}
524 530
525 531
526
527int 532int
528main (int argc, char *const *argv) 533main (int argc, char *const *argv)
529{ 534{
530 unsigned int errorCount = 0; 535 unsigned int errorCount = 0;
531 (void) argc; /* Unused. Silent compiler warning. */ 536 (void) argc; /* Unused. Silent compiler warning. */
532 537
533 if ((NULL == argv)||(0 == argv[0])) 538 if ((NULL == argv) || (0 == argv[0]))
534 return 99; 539 return 99;
535 oneone = has_in_name (argv[0], "11"); 540 oneone = has_in_name (argv[0], "11");
536 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS)) 541 if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index df399268..2326310a 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -67,6 +67,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
67 return wrt; 67 return wrt;
68} 68}
69 69
70
70static size_t 71static size_t
71copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 72copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
72{ 73{
@@ -79,6 +80,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
79 return size * nmemb; 80 return size * nmemb;
80} 81}
81 82
83
82static int 84static int
83ahc_echo (void *cls, 85ahc_echo (void *cls,
84 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
@@ -152,7 +154,7 @@ testInternalPut ()
152 { 154 {
153 const union MHD_DaemonInfo *dinfo; 155 const union MHD_DaemonInfo *dinfo;
154 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 156 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
155 if ((NULL == dinfo) ||(0 == dinfo->port) ) 157 if ((NULL == dinfo) || (0 == dinfo->port) )
156 { 158 {
157 MHD_stop_daemon (d); return 32; 159 MHD_stop_daemon (d); return 32;
158 } 160 }
@@ -196,6 +198,7 @@ testInternalPut ()
196 return 0; 198 return 0;
197} 199}
198 200
201
199static int 202static int
200testMultithreadedPut () 203testMultithreadedPut ()
201{ 204{
@@ -230,7 +233,7 @@ testMultithreadedPut ()
230 { 233 {
231 const union MHD_DaemonInfo *dinfo; 234 const union MHD_DaemonInfo *dinfo;
232 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 235 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
233 if ((NULL == dinfo) ||(0 == dinfo->port) ) 236 if ((NULL == dinfo) || (0 == dinfo->port) )
234 { 237 {
235 MHD_stop_daemon (d); return 32; 238 MHD_stop_daemon (d); return 32;
236 } 239 }
@@ -275,6 +278,7 @@ testMultithreadedPut ()
275 return 0; 278 return 0;
276} 279}
277 280
281
278static int 282static int
279testMultithreadedPoolPut () 283testMultithreadedPoolPut ()
280{ 284{
@@ -309,7 +313,7 @@ testMultithreadedPoolPut ()
309 { 313 {
310 const union MHD_DaemonInfo *dinfo; 314 const union MHD_DaemonInfo *dinfo;
311 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 315 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
312 if ((NULL == dinfo) ||(0 == dinfo->port) ) 316 if ((NULL == dinfo) || (0 == dinfo->port) )
313 { 317 {
314 MHD_stop_daemon (d); return 32; 318 MHD_stop_daemon (d); return 32;
315 } 319 }
@@ -399,7 +403,7 @@ testExternalPut ()
399 { 403 {
400 const union MHD_DaemonInfo *dinfo; 404 const union MHD_DaemonInfo *dinfo;
401 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 405 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
402 if ((NULL == dinfo) ||(0 == dinfo->port) ) 406 if ((NULL == dinfo) || (0 == dinfo->port) )
403 { 407 {
404 MHD_stop_daemon (d); return 32; 408 MHD_stop_daemon (d); return 32;
405 } 409 }
@@ -480,9 +484,10 @@ testExternalPut ()
480 if (EINTR != errno) 484 if (EINTR != errno)
481 abort (); 485 abort ();
482#else 486#else
483 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 487 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
484 ws.fd_count) 488 ws.
485 ||(0 != es.fd_count) ) 489 fd_count)
490 || (0 != es.fd_count) )
486 _exit (99); 491 _exit (99);
487 Sleep (1000); 492 Sleep (1000);
488#endif 493#endif
@@ -524,14 +529,13 @@ testExternalPut ()
524} 529}
525 530
526 531
527
528int 532int
529main (int argc, char *const *argv) 533main (int argc, char *const *argv)
530{ 534{
531 unsigned int errorCount = 0; 535 unsigned int errorCount = 0;
532 (void) argc; /* Unused. Silent compiler warning. */ 536 (void) argc; /* Unused. Silent compiler warning. */
533 537
534 if ((NULL == argv)||(0 == argv[0])) 538 if ((NULL == argv) || (0 == argv[0]))
535 return 99; 539 return 99;
536 oneone = has_in_name (argv[0], "11"); 540 oneone = has_in_name (argv[0], "11");
537 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 541 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c
index 6374f4a7..0824b286 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -67,6 +67,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
67 return wrt; 67 return wrt;
68} 68}
69 69
70
70static size_t 71static size_t
71copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 72copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
72{ 73{
@@ -79,6 +80,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
79 return size * nmemb; 80 return size * nmemb;
80} 81}
81 82
83
82static int 84static int
83ahc_echo (void *cls, 85ahc_echo (void *cls,
84 struct MHD_Connection *connection, 86 struct MHD_Connection *connection,
@@ -159,7 +161,7 @@ testInternalPut ()
159 { 161 {
160 const union MHD_DaemonInfo *dinfo; 162 const union MHD_DaemonInfo *dinfo;
161 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 163 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
162 if ((NULL == dinfo) ||(0 == dinfo->port) ) 164 if ((NULL == dinfo) || (0 == dinfo->port) )
163 { 165 {
164 MHD_stop_daemon (d); return 32; 166 MHD_stop_daemon (d); return 32;
165 } 167 }
@@ -203,6 +205,7 @@ testInternalPut ()
203 return 0; 205 return 0;
204} 206}
205 207
208
206static int 209static int
207testMultithreadedPut () 210testMultithreadedPut ()
208{ 211{
@@ -233,7 +236,7 @@ testMultithreadedPut ()
233 { 236 {
234 const union MHD_DaemonInfo *dinfo; 237 const union MHD_DaemonInfo *dinfo;
235 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 238 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
236 if ((NULL == dinfo) ||(0 == dinfo->port) ) 239 if ((NULL == dinfo) || (0 == dinfo->port) )
237 { 240 {
238 MHD_stop_daemon (d); return 32; 241 MHD_stop_daemon (d); return 32;
239 } 242 }
@@ -278,6 +281,7 @@ testMultithreadedPut ()
278 return 0; 281 return 0;
279} 282}
280 283
284
281static int 285static int
282testMultithreadedPoolPut () 286testMultithreadedPoolPut ()
283{ 287{
@@ -308,7 +312,7 @@ testMultithreadedPoolPut ()
308 { 312 {
309 const union MHD_DaemonInfo *dinfo; 313 const union MHD_DaemonInfo *dinfo;
310 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 314 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
311 if ((NULL == dinfo) ||(0 == dinfo->port) ) 315 if ((NULL == dinfo) || (0 == dinfo->port) )
312 { 316 {
313 MHD_stop_daemon (d); return 32; 317 MHD_stop_daemon (d); return 32;
314 } 318 }
@@ -398,7 +402,7 @@ testExternalPut ()
398 { 402 {
399 const union MHD_DaemonInfo *dinfo; 403 const union MHD_DaemonInfo *dinfo;
400 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 404 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
401 if ((NULL == dinfo) ||(0 == dinfo->port) ) 405 if ((NULL == dinfo) || (0 == dinfo->port) )
402 { 406 {
403 MHD_stop_daemon (d); return 32; 407 MHD_stop_daemon (d); return 32;
404 } 408 }
@@ -475,9 +479,10 @@ testExternalPut ()
475 if (EINTR != errno) 479 if (EINTR != errno)
476 abort (); 480 abort ();
477#else 481#else
478 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 482 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
479 ws.fd_count) 483 ws.
480 ||(0 != es.fd_count) ) 484 fd_count)
485 || (0 != es.fd_count) )
481 abort (); 486 abort ();
482 Sleep (1000); 487 Sleep (1000);
483#endif 488#endif
@@ -520,7 +525,6 @@ testExternalPut ()
520} 525}
521 526
522 527
523
524int 528int
525main (int argc, char *const *argv) 529main (int argc, char *const *argv)
526{ 530{
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index c42880ce..8a79a3c4 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -157,9 +157,10 @@ ServeOneRequest (void *param)
157 if (EINTR != errno) 157 if (EINTR != errno)
158 abort (); 158 abort ();
159#else 159#else
160 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 160 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
161 ws.fd_count) 161 ws.
162 ||(0 != es.fd_count) ) 162 fd_count)
163 || (0 != es.fd_count) )
163 abort (); 164 abort ();
164 Sleep (1000); 165 Sleep (1000);
165#endif 166#endif
@@ -228,7 +229,8 @@ testGet (int type, int pool_count, int poll_flag)
228 MHD_OPTION_END); 229 MHD_OPTION_END);
229 230
230 } 231 }
231 else { 232 else
233 {
232 d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag, 234 d = MHD_start_daemon (type | MHD_USE_ERROR_LOG | MHD_USE_ITC | poll_flag,
233 port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END); 235 port, NULL, NULL, &ahc_echo, "GET", MHD_OPTION_END);
234 } 236 }
@@ -238,7 +240,7 @@ testGet (int type, int pool_count, int poll_flag)
238 { 240 {
239 const union MHD_DaemonInfo *dinfo; 241 const union MHD_DaemonInfo *dinfo;
240 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 242 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
241 if ((NULL == dinfo) ||(0 == dinfo->port) ) 243 if ((NULL == dinfo) || (0 == dinfo->port) )
242 { 244 {
243 MHD_stop_daemon (d); return 32; 245 MHD_stop_daemon (d); return 32;
244 } 246 }
@@ -395,7 +397,7 @@ testExternalGet ()
395 { 397 {
396 const union MHD_DaemonInfo *dinfo; 398 const union MHD_DaemonInfo *dinfo;
397 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 399 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
398 if ((NULL == dinfo) ||(0 == dinfo->port) ) 400 if ((NULL == dinfo) || (0 == dinfo->port) )
399 { 401 {
400 MHD_stop_daemon (d); return 32; 402 MHD_stop_daemon (d); return 32;
401 } 403 }
@@ -456,10 +458,10 @@ testExternalGet ()
456 if (EINTR != errno) 458 if (EINTR != errno)
457 abort (); 459 abort ();
458#else 460#else
459 if ((WSAEINVAL != WSAGetLastError ()) ||(0 != rs.fd_count) ||(0 != 461 if ((WSAEINVAL != WSAGetLastError ()) || (0 != rs.fd_count) || (0 !=
460 ws. 462 ws.
461 fd_count) 463 fd_count)
462 ||(0 != es.fd_count) ) 464 || (0 != es.fd_count) )
463 abort (); 465 abort ();
464 Sleep (1000); 466 Sleep (1000);
465#endif 467#endif
@@ -472,7 +474,7 @@ testExternalGet ()
472 break; 474 break;
473 if (msg->msg == CURLMSG_DONE) 475 if (msg->msg == CURLMSG_DONE)
474 { 476 {
475 if ((i == 0) &&(msg->data.result != CURLE_OK) ) 477 if ((i == 0) && (msg->data.result != CURLE_OK) )
476 printf ("%s failed at %s:%d: `%s'\n", 478 printf ("%s failed at %s:%d: `%s'\n",
477 "curl_multi_perform", 479 "curl_multi_perform",
478 __FILE__, 480 __FILE__,
diff --git a/src/testcurl/test_quiesce_stream.c b/src/testcurl/test_quiesce_stream.c
index 821f1102..cb1e71cb 100644
--- a/src/testcurl/test_quiesce_stream.c
+++ b/src/testcurl/test_quiesce_stream.c
@@ -108,7 +108,7 @@ http_ContentReaderCallback (void *cls,
108 struct ContentReaderUserdata *userdata = cls; 108 struct ContentReaderUserdata *userdata = cls;
109 (void) pos; (void) max; /* Unused. Silent compiler warning. */ 109 (void) pos; (void) max; /* Unused. Silent compiler warning. */
110 110
111 if ( userdata->bytes_written >= 1024) 111 if (userdata->bytes_written >= 1024)
112 { 112 {
113 fprintf (stderr, 113 fprintf (stderr,
114 "finish: %d\n", 114 "finish: %d\n",
@@ -218,7 +218,7 @@ main (void)
218 { 218 {
219 const union MHD_DaemonInfo *dinfo; 219 const union MHD_DaemonInfo *dinfo;
220 dinfo = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_BIND_PORT); 220 dinfo = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_BIND_PORT);
221 if ((NULL == dinfo) ||(0 == dinfo->port) ) 221 if ((NULL == dinfo) || (0 == dinfo->port) )
222 { 222 {
223 MHD_stop_daemon (daemon); return 32; 223 MHD_stop_daemon (daemon); return 32;
224 } 224 }
diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c
index cd99e0af..17940020 100644
--- a/src/testcurl/test_termination.c
+++ b/src/testcurl/test_termination.c
@@ -82,6 +82,7 @@ connection_handler (void *cls,
82 return ret; 82 return ret;
83} 83}
84 84
85
85static size_t 86static size_t
86write_data (void *ptr, size_t size, size_t nmemb, void *stream) 87write_data (void *ptr, size_t size, size_t nmemb, void *stream)
87{ 88{
@@ -89,6 +90,7 @@ write_data (void *ptr, size_t size, size_t nmemb, void *stream)
89 return size * nmemb; 90 return size * nmemb;
90} 91}
91 92
93
92int 94int
93main (void) 95main (void)
94{ 96{
@@ -119,7 +121,7 @@ main (void)
119 { 121 {
120 const union MHD_DaemonInfo *dinfo; 122 const union MHD_DaemonInfo *dinfo;
121 dinfo = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_BIND_PORT); 123 dinfo = MHD_get_daemon_info (daemon, MHD_DAEMON_INFO_BIND_PORT);
122 if ((NULL == dinfo) ||(0 == dinfo->port) ) 124 if ((NULL == dinfo) || (0 == dinfo->port) )
123 { 125 {
124 MHD_stop_daemon (daemon); return 32; 126 MHD_stop_daemon (daemon); return 32;
125 } 127 }
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index a17b0fb8..db1c1e6a 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -199,7 +199,7 @@ testWithoutTimeout ()
199 { 199 {
200 const union MHD_DaemonInfo *dinfo; 200 const union MHD_DaemonInfo *dinfo;
201 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 201 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
202 if ((NULL == dinfo) ||(0 == dinfo->port) ) 202 if ((NULL == dinfo) || (0 == dinfo->port) )
203 { 203 {
204 MHD_stop_daemon (d); return 32; 204 MHD_stop_daemon (d); return 32;
205 } 205 }
@@ -240,6 +240,7 @@ testWithoutTimeout ()
240 return 0; 240 return 0;
241} 241}
242 242
243
243static int 244static int
244testWithTimeout () 245testWithTimeout ()
245{ 246{
@@ -276,7 +277,7 @@ testWithTimeout ()
276 { 277 {
277 const union MHD_DaemonInfo *dinfo; 278 const union MHD_DaemonInfo *dinfo;
278 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 279 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
279 if ((NULL == dinfo) ||(0 == dinfo->port) ) 280 if ((NULL == dinfo) || (0 == dinfo->port) )
280 { 281 {
281 MHD_stop_daemon (d); return 32; 282 MHD_stop_daemon (d); return 32;
282 } 283 }
@@ -325,7 +326,7 @@ main (int argc, char *const *argv)
325 unsigned int errorCount = 0; 326 unsigned int errorCount = 0;
326 (void) argc; /* Unused. Silent compiler warning. */ 327 (void) argc; /* Unused. Silent compiler warning. */
327 328
328 if ((NULL == argv)||(0 == argv[0])) 329 if ((NULL == argv) || (0 == argv[0]))
329 return 99; 330 return 99;
330 oneone = has_in_name (argv[0], "11"); 331 oneone = has_in_name (argv[0], "11");
331 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 332 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index f1bab3d1..e8770330 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -68,6 +68,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
68 return size * nmemb; 68 return size * nmemb;
69} 69}
70 70
71
71static int 72static int
72test_values (void *cls, 73test_values (void *cls,
73 enum MHD_ValueKind kind, 74 enum MHD_ValueKind kind,
@@ -87,6 +88,7 @@ test_values (void *cls,
87 return MHD_YES; 88 return MHD_YES;
88} 89}
89 90
91
90static int 92static int
91ahc_echo (void *cls, 93ahc_echo (void *cls,
92 struct MHD_Connection *connection, 94 struct MHD_Connection *connection,
@@ -156,7 +158,7 @@ testInternalGet (int poll_flag)
156 { 158 {
157 const union MHD_DaemonInfo *dinfo; 159 const union MHD_DaemonInfo *dinfo;
158 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT); 160 dinfo = MHD_get_daemon_info (d, MHD_DAEMON_INFO_BIND_PORT);
159 if ((NULL == dinfo) ||(0 == dinfo->port) ) 161 if ((NULL == dinfo) || (0 == dinfo->port) )
160 { 162 {
161 MHD_stop_daemon (d); return 32; 163 MHD_stop_daemon (d); return 32;
162 } 164 }
@@ -205,7 +207,7 @@ main (int argc, char *const *argv)
205 unsigned int errorCount = 0; 207 unsigned int errorCount = 0;
206 (void) argc; /* Unused. Silent compiler warning. */ 208 (void) argc; /* Unused. Silent compiler warning. */
207 209
208 if ((NULL == argv)||(0 == argv[0])) 210 if ((NULL == argv) || (0 == argv[0]))
209 return 99; 211 return 99;
210 oneone = has_in_name (argv[0], "11"); 212 oneone = has_in_name (argv[0], "11");
211 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 213 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
diff --git a/src/testzzuf/socat.c b/src/testzzuf/socat.c
index 07cbf464..29b086bb 100644
--- a/src/testzzuf/socat.c
+++ b/src/testzzuf/socat.c
@@ -109,4 +109,5 @@ zzuf_socat_stop ()
109 } 109 }
110} 110}
111 111
112
112/* end of socat.c */ 113/* end of socat.c */
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index cfa70b13..83d92ab3 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -59,6 +59,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
59 return size * nmemb; 59 return size * nmemb;
60} 60}
61 61
62
62static int 63static int
63ahc_echo (void *cls, 64ahc_echo (void *cls,
64 struct MHD_Connection *connection, 65 struct MHD_Connection *connection,
@@ -138,6 +139,7 @@ testInternalGet ()
138 return 0; 139 return 0;
139} 140}
140 141
142
141static int 143static int
142testMultithreadedGet () 144testMultithreadedGet ()
143{ 145{
diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c
index facad587..8ad7dd6b 100644
--- a/src/testzzuf/test_get_chunked.c
+++ b/src/testzzuf/test_get_chunked.c
@@ -57,6 +57,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
57 return size * nmemb; 57 return size * nmemb;
58} 58}
59 59
60
60/** 61/**
61 * MHD content reader callback that returns 62 * MHD content reader callback that returns
62 * data in chunks. 63 * data in chunks.
@@ -77,6 +78,7 @@ crc (void *cls, uint64_t pos, char *buf, size_t max)
77 return 128; 78 return 128;
78} 79}
79 80
81
80/** 82/**
81 * Dummy function that does nothing. 83 * Dummy function that does nothing.
82 */ 84 */
@@ -86,6 +88,7 @@ crcf (void *ptr)
86 free (ptr); 88 free (ptr);
87} 89}
88 90
91
89static int 92static int
90ahc_echo (void *cls, 93ahc_echo (void *cls,
91 struct MHD_Connection *connection, 94 struct MHD_Connection *connection,
@@ -132,6 +135,7 @@ ahc_echo (void *cls,
132 return ret; 135 return ret;
133} 136}
134 137
138
135static int 139static int
136testInternalGet () 140testInternalGet ()
137{ 141{
@@ -174,6 +178,7 @@ testInternalGet ()
174 return 0; 178 return 0;
175} 179}
176 180
181
177static int 182static int
178testMultithreadedGet () 183testMultithreadedGet ()
179{ 184{
@@ -328,7 +333,6 @@ testExternalGet ()
328} 333}
329 334
330 335
331
332int 336int
333main (int argc, char *const *argv) 337main (int argc, char *const *argv)
334{ 338{
diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c
index 5ffaf272..6595ad4e 100644
--- a/src/testzzuf/test_long_header.c
+++ b/src/testzzuf/test_long_header.c
@@ -54,6 +54,7 @@ apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen)
54 return MHD_YES; 54 return MHD_YES;
55} 55}
56 56
57
57struct CBC 58struct CBC
58{ 59{
59 char *buf; 60 char *buf;
@@ -68,6 +69,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
68 return size * nmemb; 69 return size * nmemb;
69} 70}
70 71
72
71static int 73static int
72ahc_echo (void *cls, 74ahc_echo (void *cls,
73 struct MHD_Connection *connection, 75 struct MHD_Connection *connection,
diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c
index 90da5e02..637423c8 100644
--- a/src/testzzuf/test_post.c
+++ b/src/testzzuf/test_post.c
@@ -106,6 +106,7 @@ post_iterator (void *cls,
106 return MHD_YES; 106 return MHD_YES;
107} 107}
108 108
109
109static int 110static int
110ahc_echo (void *cls, 111ahc_echo (void *cls,
111 struct MHD_Connection *connection, 112 struct MHD_Connection *connection,
@@ -201,6 +202,7 @@ testInternalPost ()
201 return 0; 202 return 0;
202} 203}
203 204
205
204static int 206static int
205testMultithreadedPost () 207testMultithreadedPost ()
206{ 208{
diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c
index d7c2fad3..a253b96d 100644
--- a/src/testzzuf/test_post_form.c
+++ b/src/testzzuf/test_post_form.c
@@ -76,6 +76,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
76 return size * nmemb; 76 return size * nmemb;
77} 77}
78 78
79
79/** 80/**
80 * Note that this post_iterator is not perfect 81 * Note that this post_iterator is not perfect
81 * in that it fails to support incremental processing. 82 * in that it fails to support incremental processing.
@@ -153,6 +154,7 @@ ahc_echo (void *cls,
153 return MHD_YES; 154 return MHD_YES;
154} 155}
155 156
157
156static struct curl_httppost * 158static struct curl_httppost *
157make_form () 159make_form ()
158{ 160{
diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c
index 605f4804..2c79c759 100644
--- a/src/testzzuf/test_put.c
+++ b/src/testzzuf/test_put.c
@@ -62,6 +62,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
62 return wrt; 62 return wrt;
63} 63}
64 64
65
65static size_t 66static size_t
66copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 67copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
67{ 68{
@@ -74,6 +75,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
74 return size * nmemb; 75 return size * nmemb;
75} 76}
76 77
78
77static int 79static int
78ahc_echo (void *cls, 80ahc_echo (void *cls,
79 struct MHD_Connection *connection, 81 struct MHD_Connection *connection,
@@ -167,6 +169,7 @@ testInternalPut ()
167 return 0; 169 return 0;
168} 170}
169 171
172
170static int 173static int
171testMultithreadedPut () 174testMultithreadedPut ()
172{ 175{
@@ -281,7 +284,6 @@ testExternalPut ()
281 curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); 284 curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L);
282 285
283 286
284
285 mret = curl_multi_add_handle (multi, c); 287 mret = curl_multi_add_handle (multi, c);
286 if (mret != CURLM_OK) 288 if (mret != CURLM_OK)
287 { 289 {
diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c
index f66e1ff9..29108008 100644
--- a/src/testzzuf/test_put_chunked.c
+++ b/src/testzzuf/test_put_chunked.c
@@ -62,6 +62,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
62 return wrt; 62 return wrt;
63} 63}
64 64
65
65static size_t 66static size_t
66copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 67copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
67{ 68{
@@ -74,6 +75,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
74 return size * nmemb; 75 return size * nmemb;
75} 76}
76 77
78
77static int 79static int
78ahc_echo (void *cls, 80ahc_echo (void *cls,
79 struct MHD_Connection *connection, 81 struct MHD_Connection *connection,
@@ -172,6 +174,7 @@ testInternalPut ()
172 return 0; 174 return 0;
173} 175}
174 176
177
175static int 178static int
176testMultithreadedPut () 179testMultithreadedPut ()
177{ 180{
@@ -355,7 +358,6 @@ testExternalPut ()
355} 358}
356 359
357 360
358
359int 361int
360main (int argc, char *const *argv) 362main (int argc, char *const *argv)
361{ 363{
diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c
index 1186f583..56b076c5 100644
--- a/src/testzzuf/test_put_large.c
+++ b/src/testzzuf/test_put_large.c
@@ -70,6 +70,7 @@ putBuffer (void *stream, size_t size, size_t nmemb, void *ptr)
70 return wrt; 70 return wrt;
71} 71}
72 72
73
73static size_t 74static size_t
74copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx) 75copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
75{ 76{
@@ -82,6 +83,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
82 return size * nmemb; 83 return size * nmemb;
83} 84}
84 85
86
85static int 87static int
86ahc_echo (void *cls, 88ahc_echo (void *cls,
87 struct MHD_Connection *connection, 89 struct MHD_Connection *connection,
@@ -182,6 +184,7 @@ testInternalPut ()
182 return 0; 184 return 0;
183} 185}
184 186
187
185static int 188static int
186testMultithreadedPut () 189testMultithreadedPut ()
187{ 190{
@@ -299,7 +302,6 @@ testExternalPut ()
299 curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L); 302 curl_easy_setopt (c, CURLOPT_NOSIGNAL, 1L);
300 303
301 304
302
303 mret = curl_multi_add_handle (multi, c); 305 mret = curl_multi_add_handle (multi, c);
304 if (mret != CURLM_OK) 306 if (mret != CURLM_OK)
305 { 307 {