diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-19 15:24:45 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-04-19 16:23:21 +0300 |
commit | 69c600bd8510c3ec94f1f4ca8557e42832d6c142 (patch) | |
tree | 561f06d3e01298af6df83c4ac34550726d48bef2 | |
parent | 65dac757a60174baea939a595336672c051fa678 (diff) | |
download | libmicrohttpd-69c600bd8510c3ec94f1f4ca8557e42832d6c142.tar.gz libmicrohttpd-69c600bd8510c3ec94f1f4ca8557e42832d6c142.zip |
mhd_send: added TLS-specific error code
-rw-r--r-- | src/microhttpd/connection.c | 2 | ||||
-rw-r--r-- | src/microhttpd/connection.h | 5 | ||||
-rw-r--r-- | src/microhttpd/mhd_send.c | 12 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index baf0fcb4..3eaa2935 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -152,6 +152,8 @@ str_conn_error_ (ssize_t mhd_err_code) | |||
152 | return _ ("Argument value is not supported"); | 152 | return _ ("Argument value is not supported"); |
153 | case MHD_ERR_PIPE_: | 153 | case MHD_ERR_PIPE_: |
154 | return _ ("The socket is no longer available for sending"); | 154 | return _ ("The socket is no longer available for sending"); |
155 | case MHD_ERR_TLS_: | ||
156 | return _ ("TLS encryption or decryption error"); | ||
155 | default: | 157 | default: |
156 | break; /* Mute compiler warning */ | 158 | break; /* Mute compiler warning */ |
157 | } | 159 | } |
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h index f7d7b17a..b21029e6 100644 --- a/src/microhttpd/connection.h +++ b/src/microhttpd/connection.h | |||
@@ -71,6 +71,11 @@ | |||
71 | */ | 71 | */ |
72 | #define MHD_ERR_PIPE_ (-3080) | 72 | #define MHD_ERR_PIPE_ (-3080) |
73 | 73 | ||
74 | /** | ||
75 | * General TLS encryption or decryption error | ||
76 | */ | ||
77 | #define MHD_ERR_TLS_ (-4097) | ||
78 | |||
74 | 79 | ||
75 | /** | 80 | /** |
76 | * Set callbacks for this connection to those for HTTP. | 81 | * Set callbacks for this connection to those for HTTP. |
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index 049034c9..a9f2b484 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -788,8 +788,16 @@ MHD_send_data_ (struct MHD_Connection *connection, | |||
788 | if (GNUTLS_E_INTERRUPTED == ret) | 788 | if (GNUTLS_E_INTERRUPTED == ret) |
789 | return MHD_ERR_AGAIN_; | 789 | return MHD_ERR_AGAIN_; |
790 | if ( (GNUTLS_E_ENCRYPTION_FAILED == ret) || | 790 | if ( (GNUTLS_E_ENCRYPTION_FAILED == ret) || |
791 | (GNUTLS_E_INVALID_SESSION == ret) ) | 791 | (GNUTLS_E_INVALID_SESSION == ret) || |
792 | return MHD_ERR_INVAL_; | 792 | (GNUTLS_E_COMPRESSION_FAILED == ret) || |
793 | (GNUTLS_E_EXPIRED == ret) || | ||
794 | (GNUTLS_E_HASH_FAILED == ret) ) | ||
795 | return MHD_ERR_TLS_; | ||
796 | if ( (GNUTLS_E_PUSH_ERROR == ret) || | ||
797 | (GNUTLS_E_INTERNAL_ERROR == ret) || | ||
798 | (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == ret) || | ||
799 | (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == ret) ) | ||
800 | return MHD_ERR_PIPE_; | ||
793 | if (GNUTLS_E_PREMATURE_TERMINATION == ret) | 801 | if (GNUTLS_E_PREMATURE_TERMINATION == ret) |
794 | return MHD_ERR_CONNRESET_; | 802 | return MHD_ERR_CONNRESET_; |
795 | if (GNUTLS_E_MEMORY_ERROR == ret) | 803 | if (GNUTLS_E_MEMORY_ERROR == ret) |