aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-07-19 18:11:40 +0000
committerng0 <ng0@n0.is>2019-07-19 18:11:40 +0000
commit34c88c2244f91a4fd1e7feaf3b5b656cc66a25c9 (patch)
tree3ed18c27636e96d9f71100ff8e3ce289ce0c4424
parent61b84b6afc18961f244cf648040d07aaf36cdc62 (diff)
downloadlibmicrohttpd-34c88c2244f91a4fd1e7feaf3b5b656cc66a25c9.tar.gz
libmicrohttpd-34c88c2244f91a4fd1e7feaf3b5b656cc66a25c9.zip
combine ifs, fix uninitialized var error
-rw-r--r--src/microhttpd/mhd_send.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 5e529646..f087a326 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -80,7 +80,6 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
80 bool have_more; 80 bool have_more;
81 bool use_corknopush; 81 bool use_corknopush;
82 bool using_tls = false; 82 bool using_tls = false;
83 /* The socket. */
84 MHD_socket s = connection->socket_fd; 83 MHD_socket s = connection->socket_fd;
85 ssize_t ret; 84 ssize_t ret;
86 const MHD_SCKT_OPT_BOOL_ off_val = 0; 85 const MHD_SCKT_OPT_BOOL_ off_val = 0;
@@ -135,9 +134,7 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
135#endif 134#endif
136 135
137#if TCP_CORK 136#if TCP_CORK
138 if (use_corknopush) 137 if ((use_corknopush) && (have_cork && ! want_cork))
139 {
140 if (have_cork && ! want_cork)
141 { 138 {
142 if (0 == setsockopt (connection->socket_fd, 139 if (0 == setsockopt (connection->socket_fd,
143 IPPROTO_TCP, 140 IPPROTO_TCP,
@@ -160,16 +157,13 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
160 // at least since Linux 2.2 and both can be combined since 157 // at least since Linux 2.2 and both can be combined since
161 // Linux 2.5.71. See tcp(7). No other system in 2019-06 has TCP_CORK. 158 // Linux 2.5.71. See tcp(7). No other system in 2019-06 has TCP_CORK.
162 } 159 }
163 }
164#elif TCP_NOPUSH 160#elif TCP_NOPUSH
165 /* 161 /*
166 * TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the 162 * TCP_NOPUSH on FreeBSD is equal to cork on Linux, with the
167 * exception that we know that TCP_NOPUSH will definitely 163 * exception that we know that TCP_NOPUSH will definitely
168 * exist and we can disregard TCP_NODELAY unless requested. 164 * exist and we can disregard TCP_NODELAY unless requested.
169 */ 165 */
170 if (use_corknopush) 166 if ((use_corknopush) && (have_cork && ! want_cork))
171 {
172 if (have_cork && ! want_cork)
173 { 167 {
174 setsockopt (connection->socket_fd, 168 setsockopt (connection->socket_fd,
175 IPPROTO_TCP, 169 IPPROTO_TCP,
@@ -178,12 +172,9 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
178 sizeof (on_val)); 172 sizeof (on_val));
179 connection->sk_tcp_nodelay_on = false; 173 connection->sk_tcp_nodelay_on = false;
180 } 174 }
181 }
182#endif 175#endif
183#if TCP_NODELAY 176#if TCP_NODELAY
184 if (! use_corknopush) 177 if ((! use_corknopush) && (! have_cork && want_cork))
185 {
186 if (! have_cork && want_cork)
187 { 178 {
188 setsockopt (connection->socket_fd, 179 setsockopt (connection->socket_fd,
189 IPPROTO_TCP, 180 IPPROTO_TCP,
@@ -192,12 +183,12 @@ MHD_send_on_connection_ (struct MHD_Connection *connection,
192 sizeof (off_val)); 183 sizeof (off_val));
193 connection->sk_tcp_nodelay_on = false; 184 connection->sk_tcp_nodelay_on = false;
194 } 185 }
195 }
196#endif 186#endif
197 187
198#ifdef HTTPS_SUPPORT 188#ifdef HTTPS_SUPPORT
199 if (using_tls) 189 if (using_tls)
200 { 190 {
191 int i;
201 if (i > SSIZE_MAX) 192 if (i > SSIZE_MAX)
202 i = SSIZE_MAX; 193 i = SSIZE_MAX;
203 ret = gnutls_record_send (connection->tls_session, 194 ret = gnutls_record_send (connection->tls_session,