libmicrohttpd

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

commit 8435c616da188dbb0608774503506fc70c579d5d
parent 578f5e425d8cd1de4c5e777aaec9cefe1af74e13
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 29 Nov 2020 23:04:24 +0300

mhd_send: fixed compatibility with platforms without TCP_CORK and TCP_NOPUSH

TCP_NODELAY must be turned of *before* send()
otherwise it doesn't push buffered data.

Diffstat:
Msrc/microhttpd/mhd_send.c | 23+++++------------------
1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c @@ -186,18 +186,17 @@ pre_cork_setsockopt (struct MHD_Connection *connection, break; } #else - /* CORK/NOPUSH/MSG_MORE do not exist on this platform, - so we must toggle Naggle's algorithm on/off instead + /* CORK/NOPUSH do not exist on this platform, + Turning on/off of Naggle's algorithm (otherwise we keep it always off) */ if (connection->sk_cork_on == want_cork) { /* nothing to do, success! */ return; } - if ( (want_cork) && - (0 == MHD_socket_set_nodelay_ (connection->socket_fd, - false)) ) - connection->sk_cork_on = true; + if (0 == MHD_socket_set_nodelay_ (connection->socket_fd, + (! want_cork))) + connection->sk_cork_on = want_cork; #endif } @@ -284,18 +283,6 @@ post_cork_setsockopt (struct MHD_Connection *connection, break; } #else - /* CORK/NOPUSH/MSG_MORE do not exist on this platform, - so we must toggle Naggle's algorithm on/off instead - (otherwise we keep it always off) */ - if (connection->sk_cork_on == want_cork) - { - /* nothing to do, success! */ - return; - } - if ( (! want_cork) && - (0 == MHD_socket_set_nodelay_ (connection->socket_fd, - true)) ) - connection->sk_cork_on = false; #endif }