libmicrohttpd

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

commit 34c88c2244f91a4fd1e7feaf3b5b656cc66a25c9
parent 61b84b6afc18961f244cf648040d07aaf36cdc62
Author: ng0 <ng0@n0.is>
Date:   Fri, 19 Jul 2019 18:11:40 +0000

combine ifs, fix uninitialized var error

Diffstat:
Msrc/microhttpd/mhd_send.c | 17++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c @@ -80,7 +80,6 @@ MHD_send_on_connection_ (struct MHD_Connection *connection, bool have_more; bool use_corknopush; bool using_tls = false; - /* The socket. */ MHD_socket s = connection->socket_fd; ssize_t ret; const MHD_SCKT_OPT_BOOL_ off_val = 0; @@ -135,9 +134,7 @@ MHD_send_on_connection_ (struct MHD_Connection *connection, #endif #if TCP_CORK - if (use_corknopush) - { - if (have_cork && ! want_cork) + if ((use_corknopush) && (have_cork && ! want_cork)) { if (0 == setsockopt (connection->socket_fd, IPPROTO_TCP, @@ -160,16 +157,13 @@ MHD_send_on_connection_ (struct MHD_Connection *connection, // at least since Linux 2.2 and both can be combined since // Linux 2.5.71. See tcp(7). No other system in 2019-06 has TCP_CORK. } - } #elif TCP_NOPUSH /* * TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the * exception that we know that TCP_NOPUSH will definitely * exist and we can disregard TCP_NODELAY unless requested. */ - if (use_corknopush) - { - if (have_cork && ! want_cork) + if ((use_corknopush) && (have_cork && ! want_cork)) { setsockopt (connection->socket_fd, IPPROTO_TCP, @@ -178,12 +172,9 @@ MHD_send_on_connection_ (struct MHD_Connection *connection, sizeof (on_val)); connection->sk_tcp_nodelay_on = false; } - } #endif #if TCP_NODELAY - if (! use_corknopush) - { - if (! have_cork && want_cork) + if ((! use_corknopush) && (! have_cork && want_cork)) { setsockopt (connection->socket_fd, IPPROTO_TCP, @@ -192,12 +183,12 @@ MHD_send_on_connection_ (struct MHD_Connection *connection, sizeof (off_val)); connection->sk_tcp_nodelay_on = false; } - } #endif #ifdef HTTPS_SUPPORT if (using_tls) { + int i; if (i > SSIZE_MAX) i = SSIZE_MAX; ret = gnutls_record_send (connection->tls_session,