libmicrohttpd

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

commit 73e423312cc7a32f5a260ec7992ed5a15abd4858
parent f1512b46b27808b0f1987a93671757e7b553eb42
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 14 Feb 2017 16:59:10 +0100

add extra check, make it work with OpenSSL 1.1, eliminate dead code, some formatting

Diffstat:
Msrc/microhttpd/response.c | 1+
Msrc/microhttpd/test_upgrade.c | 40+++++++---------------------------------
2 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c @@ -668,6 +668,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, /* transition to special 'closed' state for start of cleanup */ urh->was_closed = true; + EXTRA_CHECK (MHD_CONNECTION_UPGRADE == connection->state); connection->state = MHD_CONNECTION_UPGRADE_CLOSED; /* As soon as connection will be marked with BOTH * 'urh->was_closed' AND 'urh->clean_ready', it will diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c @@ -132,7 +132,7 @@ gnutlscli_connect (int *sock, "-connect", destination, "-verify", - "0", + "1", (char *) NULL); } _exit (1); @@ -396,39 +396,12 @@ static ssize_t wr_recv(wr_socket s, void *buf, size_t len) /** - * Perform shutdown of TCP socket for plain sockets or - * shutdown of TLS layer for TLS sockets. - * @param s the socket to shutdown - * @param how SHUT_WR or SHUT_RDWR - * @return zero on succeed, -1 otherwise - */ -static int wr_shutdown(wr_socket s, int how) -{ - if (wr_plain == s->t) - return shutdown (s->fd, how); -#ifdef HTTPS_SUPPORT - if (wr_tls == s->t) - { - ssize_t ret; - if (SHUT_WR == how) - ret = gnutls_bye (s->tls_s, GNUTLS_SHUT_WR); - else - ret = gnutls_bye (s->tls_s, GNUTLS_SHUT_RDWR); - - if (GNUTLS_E_SUCCESS == ret) - return 0; - } -#endif /* HTTPS_SUPPORT */ - return -1; -} - - -/** * Close socket and release allocated resourced * @param s the socket to close * @return zero on succeed, -1 otherwise */ -static int wr_close(wr_socket s) +static int +wr_close(wr_socket s) { int ret = (MHD_socket_close_(s->fd)) ? 0 : -1; #ifdef HTTPS_SUPPORT @@ -1130,12 +1103,13 @@ main (int argc, abort (); } } - if (TLS_LIB_GNUTLS == use_tls_tool && GNUTLS_E_SUCCESS != gnutls_global_init()) + if ( (TLS_LIB_GNUTLS == use_tls_tool) && + (GNUTLS_E_SUCCESS != gnutls_global_init()) ) abort (); #else /* ! HTTPS_SUPPORT */ fprintf (stderr, "HTTPS support was disabled by configure.\n"); - return 99; + return 77; #endif /* ! HTTPS_SUPPORT */ } @@ -1260,7 +1234,7 @@ main (int argc, "Error (code: %u)\n", error_count); #ifdef HTTPS_SUPPORT - if (test_tls && TLS_LIB_GNUTLS == use_tls_tool) + if (test_tls && (TLS_LIB_GNUTLS == use_tls_tool)) gnutls_global_deinit(); #endif /* HTTPS_SUPPORT */ return error_count != 0; /* 0 == pass */