libmicrohttpd

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

commit 69c600bd8510c3ec94f1f4ca8557e42832d6c142
parent 65dac757a60174baea939a595336672c051fa678
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Mon, 19 Apr 2021 15:24:45 +0300

mhd_send: added TLS-specific error code

Diffstat:
Msrc/microhttpd/connection.c | 2++
Msrc/microhttpd/connection.h | 5+++++
Msrc/microhttpd/mhd_send.c | 12++++++++++--
3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -152,6 +152,8 @@ str_conn_error_ (ssize_t mhd_err_code) return _ ("Argument value is not supported"); case MHD_ERR_PIPE_: return _ ("The socket is no longer available for sending"); + case MHD_ERR_TLS_: + return _ ("TLS encryption or decryption error"); default: break; /* Mute compiler warning */ } diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h @@ -71,6 +71,11 @@ */ #define MHD_ERR_PIPE_ (-3080) +/** + * General TLS encryption or decryption error + */ +#define MHD_ERR_TLS_ (-4097) + /** * Set callbacks for this connection to those for HTTP. diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c @@ -788,8 +788,16 @@ MHD_send_data_ (struct MHD_Connection *connection, if (GNUTLS_E_INTERRUPTED == ret) return MHD_ERR_AGAIN_; if ( (GNUTLS_E_ENCRYPTION_FAILED == ret) || - (GNUTLS_E_INVALID_SESSION == ret) ) - return MHD_ERR_INVAL_; + (GNUTLS_E_INVALID_SESSION == ret) || + (GNUTLS_E_COMPRESSION_FAILED == ret) || + (GNUTLS_E_EXPIRED == ret) || + (GNUTLS_E_HASH_FAILED == ret) ) + return MHD_ERR_TLS_; + if ( (GNUTLS_E_PUSH_ERROR == ret) || + (GNUTLS_E_INTERNAL_ERROR == ret) || + (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == ret) || + (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == ret) ) + return MHD_ERR_PIPE_; if (GNUTLS_E_PREMATURE_TERMINATION == ret) return MHD_ERR_CONNRESET_; if (GNUTLS_E_MEMORY_ERROR == ret)