diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 159 |
1 files changed, 84 insertions, 75 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index a21462db..31ef6909 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1333,6 +1333,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1333 | * this function. If 'was_closed' changed externally in the middle | 1333 | * this function. If 'was_closed' changed externally in the middle |
1334 | * of processing - it will be processed on next iteration. */ | 1334 | * of processing - it will be processed on next iteration. */ |
1335 | bool was_closed; | 1335 | bool was_closed; |
1336 | |||
1336 | if (daemon->shutdown) | 1337 | if (daemon->shutdown) |
1337 | { | 1338 | { |
1338 | /* Daemon shutting down, application will not receive any more data. */ | 1339 | /* Daemon shutting down, application will not receive any more data. */ |
@@ -1355,10 +1356,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1355 | { | 1356 | { |
1356 | #ifdef HAVE_MESSAGES | 1357 | #ifdef HAVE_MESSAGES |
1357 | MHD_DLOG (daemon, | 1358 | MHD_DLOG (daemon, |
1358 | _ ( | 1359 | _ ("Failed to forward to application " |
1359 | "Failed to forward to application " | 1360 | MHD_UNSIGNED_LONG_LONG_PRINTF \ |
1360 | MHD_UNSIGNED_LONG_LONG_PRINTF \ | 1361 | " bytes of data received from remote side: application shut down socket.\n"), |
1361 | " bytes of data received from remote side: application shut down socket.\n"), | ||
1362 | (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used); | 1362 | (MHD_UNSIGNED_LONG_LONG) urh->in_buffer_used); |
1363 | #endif | 1363 | #endif |
1364 | 1364 | ||
@@ -1367,7 +1367,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1367 | * check for any pending data even if socket is not marked | 1367 | * check for any pending data even if socket is not marked |
1368 | * as 'ready' (signal may arrive after poll()/select()). | 1368 | * as 'ready' (signal may arrive after poll()/select()). |
1369 | * Socketpair for forwarding is always in non-blocking mode | 1369 | * Socketpair for forwarding is always in non-blocking mode |
1370 | * so no risk that recv() will block the thread. */if (0 != urh->out_buffer_size) | 1370 | * so no risk that recv() will block the thread. */// |
1371 | if (0 != urh->out_buffer_size) | ||
1371 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; | 1372 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; |
1372 | /* Discard any data received form remote. */ | 1373 | /* Discard any data received form remote. */ |
1373 | urh->in_buffer_used = 0; | 1374 | urh->in_buffer_used = 0; |
@@ -1379,12 +1380,14 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1379 | connection->tls_read_ready = false; | 1380 | connection->tls_read_ready = false; |
1380 | } | 1381 | } |
1381 | 1382 | ||
1382 | /* On some platforms (W32, possibly Darwin) failed send() (send() will always | 1383 | /* On some platforms (W32, possibly Darwin) failed send() (send() will |
1383 | * fail after remote disconnect was detected) may discard data in system | 1384 | * always fail after remote disconnect was detected) may discard data in |
1384 | * buffers received by system but not yet read by recv(). | 1385 | * system buffers received by system but not yet read by recv(). So, before |
1385 | * So, before trying send() on any socket, recv() must be performed at first | 1386 | * trying send() on any socket, recv() must be performed at first otherwise |
1386 | * otherwise last part of incoming data may be lost. *//* If disconnect or error was detected - try to read from socket | 1387 | * last part of incoming data may be lost. If disconnect or error was |
1387 | * to dry data possibly pending is system buffers. */if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) | 1388 | * detected - try to read from socket to dry data possibly pending is system |
1389 | * buffers. */// | ||
1390 | if (0 != (MHD_EPOLL_STATE_ERROR & urh->app.celi)) | ||
1388 | urh->app.celi |= MHD_EPOLL_STATE_READ_READY; | 1391 | urh->app.celi |= MHD_EPOLL_STATE_READ_READY; |
1389 | if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) | 1392 | if (0 != (MHD_EPOLL_STATE_ERROR & urh->mhd.celi)) |
1390 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; | 1393 | urh->mhd.celi |= MHD_EPOLL_STATE_READ_READY; |
@@ -1424,10 +1427,10 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1424 | else /* 0 < res */ | 1427 | else /* 0 < res */ |
1425 | { | 1428 | { |
1426 | urh->in_buffer_used += res; | 1429 | urh->in_buffer_used += res; |
1427 | if (buf_size > (size_t) res) | 1430 | if (0 < gnutls_record_check_pending (connection->tls_session)) |
1428 | urh->app.celi &= ~MHD_EPOLL_STATE_READ_READY; | 1431 | { |
1429 | else if (0 < gnutls_record_check_pending (connection->tls_session)) | ||
1430 | connection->tls_read_ready = true; | 1432 | connection->tls_read_ready = true; |
1433 | } | ||
1431 | } | 1434 | } |
1432 | if (MHD_EPOLL_STATE_ERROR == | 1435 | if (MHD_EPOLL_STATE_ERROR == |
1433 | ((MHD_EPOLL_STATE_ERROR | MHD_EPOLL_STATE_READ_READY) & urh->app.celi)) | 1436 | ((MHD_EPOLL_STATE_ERROR | MHD_EPOLL_STATE_READ_READY) & urh->app.celi)) |
@@ -1932,8 +1935,8 @@ thread_main_handle_connection (void *data) | |||
1932 | } | 1935 | } |
1933 | #endif /* HAVE_POLL */ | 1936 | #endif /* HAVE_POLL */ |
1934 | MHD_itc_clear_ (daemon->itc); | 1937 | MHD_itc_clear_ (daemon->itc); |
1935 | continue; /* Check again for resume. */ | 1938 | continue; /* Check again for resume. */ |
1936 | } /* End of "suspended" branch. */ | 1939 | } /* End of "suspended" branch. */ |
1937 | 1940 | ||
1938 | if (was_suspended) | 1941 | if (was_suspended) |
1939 | { | 1942 | { |
@@ -2228,7 +2231,8 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon); | |||
2228 | * and if possible. | 2231 | * and if possible. |
2229 | */ | 2232 | */ |
2230 | #define MHD_TLSLIB_NEED_PUSH_FUNC 1 | 2233 | #define MHD_TLSLIB_NEED_PUSH_FUNC 1 |
2231 | #endif /* !MHD_WINSOCK_SOCKETS && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 0x030402) */ | 2234 | #endif \ |
2235 | /* !MHD_WINSOCK_SOCKETS && !MHD_socket_nosignal_ && (GNUTLS_VERSION_NUMBER+0 < 0x030402) */ | ||
2232 | 2236 | ||
2233 | #ifdef MHD_TLSLIB_NEED_PUSH_FUNC | 2237 | #ifdef MHD_TLSLIB_NEED_PUSH_FUNC |
2234 | /** | 2238 | /** |
@@ -3379,7 +3383,8 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
3379 | this is not true as if we fail to do manually remove it, | 3383 | this is not true as if we fail to do manually remove it, |
3380 | we are still seeing an event for this fd in epoll, | 3384 | we are still seeing an event for this fd in epoll, |
3381 | causing grief (use-after-free...) --- at least on my | 3385 | causing grief (use-after-free...) --- at least on my |
3382 | system. */if (0 != epoll_ctl (daemon->epoll_fd, | 3386 | system. */// |
3387 | if (0 != epoll_ctl (daemon->epoll_fd, | ||
3383 | EPOLL_CTL_DEL, | 3388 | EPOLL_CTL_DEL, |
3384 | pos->socket_fd, | 3389 | pos->socket_fd, |
3385 | NULL)) | 3390 | NULL)) |
@@ -3831,9 +3836,9 @@ MHD_select (struct MHD_Daemon *daemon, | |||
3831 | return MHD_NO; | 3836 | return MHD_NO; |
3832 | } | 3837 | } |
3833 | if (MHD_NO != internal_run_from_select (daemon, | 3838 | if (MHD_NO != internal_run_from_select (daemon, |
3834 | &rs, | 3839 | &rs, |
3835 | &ws, | 3840 | &ws, |
3836 | &es)) | 3841 | &es)) |
3837 | return (MHD_NO == err_state) ? MHD_YES : MHD_NO; | 3842 | return (MHD_NO == err_state) ? MHD_YES : MHD_NO; |
3838 | return MHD_NO; | 3843 | return MHD_NO; |
3839 | } | 3844 | } |
@@ -3920,7 +3925,7 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
3920 | timeout = 0; | 3925 | timeout = 0; |
3921 | else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || | 3926 | else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) || |
3922 | (MHD_NO == MHD_get_timeout (daemon, | 3927 | (MHD_NO == MHD_get_timeout (daemon, |
3923 | <imeout)) ) | 3928 | <imeout)) ) |
3924 | timeout = -1; | 3929 | timeout = -1; |
3925 | else | 3930 | else |
3926 | timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout; | 3931 | timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout; |
@@ -4000,9 +4005,9 @@ MHD_poll_all (struct MHD_Daemon *daemon, | |||
4000 | prev = pos->prev; | 4005 | prev = pos->prev; |
4001 | /* first, sanity checks */ | 4006 | /* first, sanity checks */ |
4002 | if (i >= num_connections) | 4007 | if (i >= num_connections) |
4003 | break; /* connection list changed somehow, retry later ... */ | 4008 | break; /* connection list changed somehow, retry later ... */ |
4004 | if (p[poll_server + i].fd != pos->socket_fd) | 4009 | if (p[poll_server + i].fd != pos->socket_fd) |
4005 | continue; /* fd mismatch, something else happened, retry later ... */ | 4010 | continue; /* fd mismatch, something else happened, retry later ... */ |
4006 | call_handlers (pos, | 4011 | call_handlers (pos, |
4007 | 0 != (p[poll_server + i].revents & POLLIN), | 4012 | 0 != (p[poll_server + i].revents & POLLIN), |
4008 | 0 != (p[poll_server + i].revents & POLLOUT), | 4013 | 0 != (p[poll_server + i].revents & POLLOUT), |
@@ -4267,22 +4272,26 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon) | |||
4267 | 4272 | ||
4268 | /* Update ueh state based on what is ready according to epoll() */ | 4273 | /* Update ueh state based on what is ready according to epoll() */ |
4269 | if (0 != (events[i].events & EPOLLIN)) | 4274 | if (0 != (events[i].events & EPOLLIN)) |
4275 | { | ||
4270 | ueh->celi |= MHD_EPOLL_STATE_READ_READY; | 4276 | ueh->celi |= MHD_EPOLL_STATE_READ_READY; |
4277 | } | ||
4271 | if (0 != (events[i].events & EPOLLOUT)) | 4278 | if (0 != (events[i].events & EPOLLOUT)) |
4279 | { | ||
4272 | ueh->celi |= MHD_EPOLL_STATE_WRITE_READY; | 4280 | ueh->celi |= MHD_EPOLL_STATE_WRITE_READY; |
4281 | } | ||
4273 | if (0 != (events[i].events & EPOLLHUP)) | 4282 | if (0 != (events[i].events & EPOLLHUP)) |
4283 | { | ||
4274 | ueh->celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; | 4284 | ueh->celi |= MHD_EPOLL_STATE_READ_READY | MHD_EPOLL_STATE_WRITE_READY; |
4285 | } | ||
4275 | 4286 | ||
4276 | if ( (0 == (ueh->celi & MHD_EPOLL_STATE_ERROR)) && | 4287 | if ( (0 == (ueh->celi & MHD_EPOLL_STATE_ERROR)) && |
4277 | (0 != (events[i].events & (EPOLLERR | EPOLLPRI))) ) | 4288 | (0 != (events[i].events & (EPOLLERR | EPOLLPRI))) ) |
4278 | { | 4289 | { |
4279 | /* Process new error state only one time | 4290 | /* Process new error state only one time and avoid continuously |
4280 | * and avoid continuously marking this connection | 4291 | * marking this connection as 'ready'. */ |
4281 | * as 'ready'. */ | ||
4282 | ueh->celi |= MHD_EPOLL_STATE_ERROR; | 4292 | ueh->celi |= MHD_EPOLL_STATE_ERROR; |
4283 | new_err_state = true; | 4293 | new_err_state = true; |
4284 | } | 4294 | } |
4285 | |||
4286 | if (! urh->in_eready_list) | 4295 | if (! urh->in_eready_list) |
4287 | { | 4296 | { |
4288 | if (new_err_state || | 4297 | if (new_err_state || |
@@ -4447,7 +4456,7 @@ MHD_epoll (struct MHD_Daemon *daemon, | |||
4447 | if (MHD_NO != may_block) | 4456 | if (MHD_NO != may_block) |
4448 | { | 4457 | { |
4449 | if (MHD_NO != MHD_get_timeout (daemon, | 4458 | if (MHD_NO != MHD_get_timeout (daemon, |
4450 | &timeout_ll)) | 4459 | &timeout_ll)) |
4451 | { | 4460 | { |
4452 | if (timeout_ll >= (MHD_UNSIGNED_LONG_LONG) INT_MAX) | 4461 | if (timeout_ll >= (MHD_UNSIGNED_LONG_LONG) INT_MAX) |
4453 | timeout_ms = INT_MAX; | 4462 | timeout_ms = INT_MAX; |
@@ -5406,10 +5415,10 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
5406 | case MHD_OPTION_CONNECTION_MEMORY_INCREMENT: | 5415 | case MHD_OPTION_CONNECTION_MEMORY_INCREMENT: |
5407 | case MHD_OPTION_THREAD_STACK_SIZE: | 5416 | case MHD_OPTION_THREAD_STACK_SIZE: |
5408 | if (MHD_NO == parse_options (daemon, | 5417 | if (MHD_NO == parse_options (daemon, |
5409 | servaddr, | 5418 | servaddr, |
5410 | opt, | 5419 | opt, |
5411 | (size_t) oa[i].value, | 5420 | (size_t) oa[i].value, |
5412 | MHD_OPTION_END)) | 5421 | MHD_OPTION_END)) |
5413 | return MHD_NO; | 5422 | return MHD_NO; |
5414 | break; | 5423 | break; |
5415 | /* all options taking 'unsigned int' */ | 5424 | /* all options taking 'unsigned int' */ |
@@ -5423,39 +5432,39 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
5423 | case MHD_OPTION_LISTEN_BACKLOG_SIZE: | 5432 | case MHD_OPTION_LISTEN_BACKLOG_SIZE: |
5424 | case MHD_OPTION_SERVER_INSANITY: | 5433 | case MHD_OPTION_SERVER_INSANITY: |
5425 | if (MHD_NO == parse_options (daemon, | 5434 | if (MHD_NO == parse_options (daemon, |
5426 | servaddr, | 5435 | servaddr, |
5427 | opt, | 5436 | opt, |
5428 | (unsigned int) oa[i].value, | 5437 | (unsigned int) oa[i].value, |
5429 | MHD_OPTION_END)) | 5438 | MHD_OPTION_END)) |
5430 | return MHD_NO; | 5439 | return MHD_NO; |
5431 | break; | 5440 | break; |
5432 | /* all options taking 'enum' */ | 5441 | /* all options taking 'enum' */ |
5433 | #ifdef HTTPS_SUPPORT | 5442 | #ifdef HTTPS_SUPPORT |
5434 | case MHD_OPTION_HTTPS_CRED_TYPE: | 5443 | case MHD_OPTION_HTTPS_CRED_TYPE: |
5435 | if (MHD_NO == parse_options (daemon, | 5444 | if (MHD_NO == parse_options (daemon, |
5436 | servaddr, | 5445 | servaddr, |
5437 | opt, | 5446 | opt, |
5438 | (gnutls_credentials_type_t) oa[i].value, | 5447 | (gnutls_credentials_type_t) oa[i].value, |
5439 | MHD_OPTION_END)) | 5448 | MHD_OPTION_END)) |
5440 | return MHD_NO; | 5449 | return MHD_NO; |
5441 | break; | 5450 | break; |
5442 | #endif /* HTTPS_SUPPORT */ | 5451 | #endif /* HTTPS_SUPPORT */ |
5443 | /* all options taking 'MHD_socket' */ | 5452 | /* all options taking 'MHD_socket' */ |
5444 | case MHD_OPTION_LISTEN_SOCKET: | 5453 | case MHD_OPTION_LISTEN_SOCKET: |
5445 | if (MHD_NO == parse_options (daemon, | 5454 | if (MHD_NO == parse_options (daemon, |
5446 | servaddr, | 5455 | servaddr, |
5447 | opt, | 5456 | opt, |
5448 | (MHD_socket) oa[i].value, | 5457 | (MHD_socket) oa[i].value, |
5449 | MHD_OPTION_END)) | 5458 | MHD_OPTION_END)) |
5450 | return MHD_NO; | 5459 | return MHD_NO; |
5451 | break; | 5460 | break; |
5452 | /* all options taking 'int' */ | 5461 | /* all options taking 'int' */ |
5453 | case MHD_OPTION_STRICT_FOR_CLIENT: | 5462 | case MHD_OPTION_STRICT_FOR_CLIENT: |
5454 | if (MHD_NO == parse_options (daemon, | 5463 | if (MHD_NO == parse_options (daemon, |
5455 | servaddr, | 5464 | servaddr, |
5456 | opt, | 5465 | opt, |
5457 | (int) oa[i].value, | 5466 | (int) oa[i].value, |
5458 | MHD_OPTION_END)) | 5467 | MHD_OPTION_END)) |
5459 | return MHD_NO; | 5468 | return MHD_NO; |
5460 | break; | 5469 | break; |
5461 | /* all options taking one pointer */ | 5470 | /* all options taking one pointer */ |
@@ -5470,10 +5479,10 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
5470 | case MHD_OPTION_HTTPS_CERT_CALLBACK: | 5479 | case MHD_OPTION_HTTPS_CERT_CALLBACK: |
5471 | case MHD_OPTION_HTTPS_CERT_CALLBACK2: | 5480 | case MHD_OPTION_HTTPS_CERT_CALLBACK2: |
5472 | if (MHD_NO == parse_options (daemon, | 5481 | if (MHD_NO == parse_options (daemon, |
5473 | servaddr, | 5482 | servaddr, |
5474 | opt, | 5483 | opt, |
5475 | oa[i].ptr_value, | 5484 | oa[i].ptr_value, |
5476 | MHD_OPTION_END)) | 5485 | MHD_OPTION_END)) |
5477 | return MHD_NO; | 5486 | return MHD_NO; |
5478 | break; | 5487 | break; |
5479 | /* all options taking two pointers */ | 5488 | /* all options taking two pointers */ |
@@ -5484,21 +5493,21 @@ parse_options_va (struct MHD_Daemon *daemon, | |||
5484 | case MHD_OPTION_UNESCAPE_CALLBACK: | 5493 | case MHD_OPTION_UNESCAPE_CALLBACK: |
5485 | case MHD_OPTION_GNUTLS_PSK_CRED_HANDLER: | 5494 | case MHD_OPTION_GNUTLS_PSK_CRED_HANDLER: |
5486 | if (MHD_NO == parse_options (daemon, | 5495 | if (MHD_NO == parse_options (daemon, |
5487 | servaddr, | 5496 | servaddr, |
5488 | opt, | 5497 | opt, |
5489 | (void *) oa[i].value, | 5498 | (void *) oa[i].value, |
5490 | oa[i].ptr_value, | 5499 | oa[i].ptr_value, |
5491 | MHD_OPTION_END)) | 5500 | MHD_OPTION_END)) |
5492 | return MHD_NO; | 5501 | return MHD_NO; |
5493 | break; | 5502 | break; |
5494 | /* options taking size_t-number followed by pointer */ | 5503 | /* options taking size_t-number followed by pointer */ |
5495 | case MHD_OPTION_DIGEST_AUTH_RANDOM: | 5504 | case MHD_OPTION_DIGEST_AUTH_RANDOM: |
5496 | if (MHD_NO == parse_options (daemon, | 5505 | if (MHD_NO == parse_options (daemon, |
5497 | servaddr, | 5506 | servaddr, |
5498 | opt, | 5507 | opt, |
5499 | (size_t) oa[i].value, | 5508 | (size_t) oa[i].value, |
5500 | oa[i].ptr_value, | 5509 | oa[i].ptr_value, |
5501 | MHD_OPTION_END)) | 5510 | MHD_OPTION_END)) |
5502 | return MHD_NO; | 5511 | return MHD_NO; |
5503 | break; | 5512 | break; |
5504 | default: | 5513 | default: |
@@ -5761,7 +5770,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5761 | #ifdef HAVE_POLL | 5770 | #ifdef HAVE_POLL |
5762 | *pflags |= MHD_USE_POLL; | 5771 | *pflags |= MHD_USE_POLL; |
5763 | #else /* ! HAVE_POLL */ | 5772 | #else /* ! HAVE_POLL */ |
5764 | /* use select() - do not modify flags */ | 5773 | /* use select() - do not modify flags */ |
5765 | #endif /* ! HAVE_POLL */ | 5774 | #endif /* ! HAVE_POLL */ |
5766 | } | 5775 | } |
5767 | else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) | 5776 | else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) |
@@ -5772,7 +5781,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5772 | #elif defined(HAVE_POLL) | 5781 | #elif defined(HAVE_POLL) |
5773 | *pflags |= MHD_USE_POLL; | 5782 | *pflags |= MHD_USE_POLL; |
5774 | #else /* !HAVE_POLL && !EPOLL_SUPPORT */ | 5783 | #else /* !HAVE_POLL && !EPOLL_SUPPORT */ |
5775 | /* use select() - do not modify flags */ | 5784 | /* use select() - do not modify flags */ |
5776 | #endif /* !HAVE_POLL && !EPOLL_SUPPORT */ | 5785 | #endif /* !HAVE_POLL && !EPOLL_SUPPORT */ |
5777 | } | 5786 | } |
5778 | else | 5787 | else |
@@ -5781,7 +5790,7 @@ MHD_start_daemon_va (unsigned int flags, | |||
5781 | #if defined(EPOLL_SUPPORT) | 5790 | #if defined(EPOLL_SUPPORT) |
5782 | *pflags |= MHD_USE_EPOLL; | 5791 | *pflags |= MHD_USE_EPOLL; |
5783 | #else /* ! EPOLL_SUPPORT */ | 5792 | #else /* ! EPOLL_SUPPORT */ |
5784 | /* use select() - do not modify flags */ | 5793 | /* use select() - do not modify flags */ |
5785 | #endif /* ! EPOLL_SUPPORT */ | 5794 | #endif /* ! EPOLL_SUPPORT */ |
5786 | } | 5795 | } |
5787 | } | 5796 | } |
@@ -5866,8 +5875,8 @@ MHD_start_daemon_va (unsigned int flags, | |||
5866 | 5875 | ||
5867 | 5876 | ||
5868 | if (MHD_NO == parse_options_va (daemon, | 5877 | if (MHD_NO == parse_options_va (daemon, |
5869 | &servaddr, | 5878 | &servaddr, |
5870 | ap)) | 5879 | ap)) |
5871 | { | 5880 | { |
5872 | #ifdef HTTPS_SUPPORT | 5881 | #ifdef HTTPS_SUPPORT |
5873 | if ( (0 != (*pflags & MHD_USE_TLS)) && | 5882 | if ( (0 != (*pflags & MHD_USE_TLS)) && |
@@ -6057,11 +6066,11 @@ MHD_start_daemon_va (unsigned int flags, | |||
6057 | #endif | 6066 | #endif |
6058 | } | 6067 | } |
6059 | #endif /* ! MHD_WINSOCK_SOCKETS */ | 6068 | #endif /* ! MHD_WINSOCK_SOCKETS */ |
6060 | /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. | 6069 | /* Use SO_REUSEADDR on Windows and SO_REUSEPORT on most platforms. |
6061 | * Fail if SO_REUSEPORT is not defined or setsockopt fails. | 6070 | * Fail if SO_REUSEPORT is not defined or setsockopt fails. |
6062 | */ | 6071 | */ |
6063 | /* SO_REUSEADDR on W32 has the same semantics | 6072 | /* SO_REUSEADDR on W32 has the same semantics |
6064 | as SO_REUSEPORT on BSD/Linux */ | 6073 | as SO_REUSEPORT on BSD/Linux */ |
6065 | #if defined(MHD_WINSOCK_SOCKETS) || defined(SO_REUSEPORT) | 6074 | #if defined(MHD_WINSOCK_SOCKETS) || defined(SO_REUSEPORT) |
6066 | if (0 > setsockopt (listen_fd, | 6075 | if (0 > setsockopt (listen_fd, |
6067 | SOL_SOCKET, | 6076 | SOL_SOCKET, |
@@ -6081,8 +6090,8 @@ MHD_start_daemon_va (unsigned int flags, | |||
6081 | goto free_and_fail; | 6090 | goto free_and_fail; |
6082 | } | 6091 | } |
6083 | #else /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ | 6092 | #else /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ |
6084 | /* we're supposed to allow address:port re-use, but | 6093 | /* we're supposed to allow address:port re-use, but |
6085 | on this platform we cannot; fail hard */ | 6094 | on this platform we cannot; fail hard */ |
6086 | #ifdef HAVE_MESSAGES | 6095 | #ifdef HAVE_MESSAGES |
6087 | MHD_DLOG (daemon, | 6096 | MHD_DLOG (daemon, |
6088 | _ ( | 6097 | _ ( |