libmicrohttpd

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

commit 123b86d1e4790d9717eff7c0502313f0fdb1c018
parent beb7fa828c59c31d4a5178b82121435f2069b181
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 27 Sep 2020 22:36:17 +0200

correct interpretation of revalue of MHD_socket_cork_

Diffstat:
Msrc/microhttpd/connection.c | 8++++++--
Msrc/microhttpd/mhd_send.c | 1+
Msrc/microhttpd/response.c | 6++++--
3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -2441,7 +2441,10 @@ check_write_done (struct MHD_Connection *connection, { if ( (connection->write_buffer_append_offset != connection->write_buffer_send_offset) || - (connection->sk_cork_on) ) + /* if we expected to turn cork off, and it is still on, + we are not finished sending (can happen with gnutls_record_uncork) */ + ( (connection->sk_cork_on) && + (MHD_CONNECTION_HEADERS_SENDING != connection->state) ) ) return MHD_NO; connection->write_buffer_append_offset = 0; connection->write_buffer_send_offset = 0; @@ -2555,7 +2558,8 @@ process_broken_line (struct MHD_Connection *connection, adjacency); also, in the case where these are not adjacent (not sure how it can happen!), we would want to allocate from the end of the pool, so as to not destroy the read-buffer's - ability to grow nicely. */last = MHD_pool_reallocate (connection->pool, + ability to grow nicely. */// + last = MHD_pool_reallocate (connection->pool, last, last_len + 1, last_len + tmp_len + 1); diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c @@ -330,6 +330,7 @@ MHD_send_on_connection_ (struct MHD_Connection *connection, buffer, buffer_size, MAYBE_MSG_NOSIGNAL | (want_cork ? MSG_MORE : 0)); + connection->sk_cork_on = want_cork; /* pretend corking happened as requested */ #else ret = send (connection->socket_fd, buffer, diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c @@ -904,7 +904,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, else #endif { - if (0 == + if (0 != MHD_socket_cork_ (connection->socket_fd, true)) { @@ -930,7 +930,9 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, else #endif { - if (0 == + if (! connection->sk_cork_on) + return MHD_YES; + if (0 != MHD_socket_cork_ (connection->socket_fd, false)) {