aboutsummaryrefslogtreecommitdiff
path: root/src/examples/refuse_post_example.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-06-01 16:15:08 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-06-01 22:12:37 +0300
commit93dcf8ea912ceb2eb83b73a7e5165a08c4db9312 (patch)
treefa6d756e8a65120a715a17621d6ed3244c14b215 /src/examples/refuse_post_example.c
parent74c2eba238ff26788eae3afac68307f49a82099b (diff)
downloadlibmicrohttpd-93dcf8ea912ceb2eb83b73a7e5165a08c4db9312.tar.gz
libmicrohttpd-93dcf8ea912ceb2eb83b73a7e5165a08c4db9312.zip
src/examples: muted compiler warnings
Diffstat (limited to 'src/examples/refuse_post_example.c')
-rw-r--r--src/examples/refuse_post_example.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/examples/refuse_post_example.c b/src/examples/refuse_post_example.c
index 70cfe4b3..8a8eac37 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -33,14 +33,15 @@ struct handler_param
33 33
34const char *askpage = 34const char *askpage =
35 "<html><body>\n\ 35 "<html><body>\n\
36 Upload a file, please!<br>\n\ 36 Upload a file, please!<br>\n\
37 <form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\ 37 <form action=\"/filepost\" method=\"post\" enctype=\"multipart/form-data\">\n\
38 <input name=\"file\" type=\"file\">\n\ 38 <input name=\"file\" type=\"file\">\n\
39 <input type=\"submit\" value=\" Send \"></form>\n\ 39 <input type=\"submit\" value=\" Send \"></form>\n\
40 </body></html>"; 40 </body></html>";
41 41
42#define BUSYPAGE \ 42#define BUSYPAGE \
43 "<html><head><title>Webserver busy</title></head><body>We are too busy to process POSTs right now.</body></html>" 43 "<html><head><title>Webserver busy</title></head>" \
44 "<body>We are too busy to process POSTs right now.</body></html>"
44 45
45static enum MHD_Result 46static enum MHD_Result
46ahc_echo (void *cls, 47ahc_echo (void *cls,
@@ -96,18 +97,25 @@ int
96main (int argc, char *const *argv) 97main (int argc, char *const *argv)
97{ 98{
98 struct MHD_Daemon *d; 99 struct MHD_Daemon *d;
99
100 struct handler_param data_for_handler; 100 struct handler_param data_for_handler;
101 int port;
101 102
102 if (argc != 2) 103 if (argc != 2)
103 { 104 {
104 printf ("%s PORT\n", argv[0]); 105 printf ("%s PORT\n", argv[0]);
105 return 1; 106 return 1;
106 } 107 }
108 port = atoi (argv[1]);
109 if ( (1 > port) || (port > 65535) )
110 {
111 fprintf (stderr,
112 "Port must be a number between 1 and 65535.\n");
113 return 1;
114 }
107 data_for_handler.response_page = askpage; 115 data_for_handler.response_page = askpage;
108 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION 116 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
109 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 117 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
110 atoi (argv[1]), 118 (uint16_t) port,
111 NULL, NULL, &ahc_echo, &data_for_handler, 119 NULL, NULL, &ahc_echo, &data_for_handler,
112 MHD_OPTION_END); 120 MHD_OPTION_END);
113 if (d == NULL) 121 if (d == NULL)