diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-12-12 13:35:12 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-12-12 13:35:12 +0300 |
commit | b4f1e487de8a91186b3a29ea7949473fb911c240 (patch) | |
tree | 6970d55745453ce770e082bf7383b05aeff648c2 /src | |
parent | 9496be92715b0970832af3bb37afaefed36cc03c (diff) | |
download | libmicrohttpd-b4f1e487de8a91186b3a29ea7949473fb911c240.tar.gz libmicrohttpd-b4f1e487de8a91186b3a29ea7949473fb911c240.zip |
Fixed compatibility with old GnuTLS versions
Diffstat (limited to 'src')
-rw-r--r-- | src/microhttpd/connection_https.c | 5 | ||||
-rw-r--r-- | src/microhttpd/daemon.c | 3 | ||||
-rw-r--r-- | src/microhttpd/mhd_send.c | 5 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c index aaef7d98..0d691706 100644 --- a/src/microhttpd/connection_https.c +++ b/src/microhttpd/connection_https.c | |||
@@ -91,8 +91,13 @@ recv_tls_adapter (struct MHD_Connection *connection, | |||
91 | (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == res) || | 91 | (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == res) || |
92 | (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == res) ) | 92 | (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == res) ) |
93 | return MHD_ERR_PIPE_; | 93 | return MHD_ERR_PIPE_; |
94 | #if defined(GNUTLS_E_PREMATURE_TERMINATION) | ||
94 | if (GNUTLS_E_PREMATURE_TERMINATION == res) | 95 | if (GNUTLS_E_PREMATURE_TERMINATION == res) |
95 | return MHD_ERR_CONNRESET_; | 96 | return MHD_ERR_CONNRESET_; |
97 | #elif defined(GNUTLS_E_UNEXPECTED_PACKET_LENGTH) | ||
98 | if (GNUTLS_E_UNEXPECTED_PACKET_LENGTH == res) | ||
99 | return MHD_ERR_CONNRESET_; | ||
100 | #endif /* GNUTLS_E_UNEXPECTED_PACKET_LENGTH */ | ||
96 | if (GNUTLS_E_MEMORY_ERROR == res) | 101 | if (GNUTLS_E_MEMORY_ERROR == res) |
97 | return MHD_ERR_NOMEM_; | 102 | return MHD_ERR_NOMEM_; |
98 | /* Treat any other error as a hard error. */ | 103 | /* Treat any other error as a hard error. */ |
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index a96ec9ae..a75dd0c0 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -2317,8 +2317,10 @@ psk_gnutls_adapter (gnutls_session_t session, | |||
2317 | { | 2317 | { |
2318 | struct MHD_Connection *connection; | 2318 | struct MHD_Connection *connection; |
2319 | struct MHD_Daemon *daemon; | 2319 | struct MHD_Daemon *daemon; |
2320 | #if GNUTLS_VERSION_MAJOR >= 3 | ||
2320 | void *app_psk; | 2321 | void *app_psk; |
2321 | size_t app_psk_size; | 2322 | size_t app_psk_size; |
2323 | #endif /* GNUTLS_VERSION_MAJOR >= 3 */ | ||
2322 | 2324 | ||
2323 | connection = gnutls_session_get_ptr (session); | 2325 | connection = gnutls_session_get_ptr (session); |
2324 | if (NULL == connection) | 2326 | if (NULL == connection) |
@@ -2371,6 +2373,7 @@ psk_gnutls_adapter (gnutls_session_t session, | |||
2371 | free (app_psk); | 2373 | free (app_psk); |
2372 | return 0; | 2374 | return 0; |
2373 | #else | 2375 | #else |
2376 | (void) username; (void) key; /* Mute compiler warning */ | ||
2374 | #ifdef HAVE_MESSAGES | 2377 | #ifdef HAVE_MESSAGES |
2375 | MHD_DLOG (daemon, | 2378 | MHD_DLOG (daemon, |
2376 | _ ("PSK not supported by this server.\n")); | 2379 | _ ("PSK not supported by this server.\n")); |
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c index 86f76b48..b4a192a9 100644 --- a/src/microhttpd/mhd_send.c +++ b/src/microhttpd/mhd_send.c | |||
@@ -799,8 +799,13 @@ MHD_send_data_ (struct MHD_Connection *connection, | |||
799 | (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == ret) || | 799 | (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == ret) || |
800 | (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == ret) ) | 800 | (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == ret) ) |
801 | return MHD_ERR_PIPE_; | 801 | return MHD_ERR_PIPE_; |
802 | #if defined(GNUTLS_E_PREMATURE_TERMINATION) | ||
802 | if (GNUTLS_E_PREMATURE_TERMINATION == ret) | 803 | if (GNUTLS_E_PREMATURE_TERMINATION == ret) |
803 | return MHD_ERR_CONNRESET_; | 804 | return MHD_ERR_CONNRESET_; |
805 | #elif defined(GNUTLS_E_UNEXPECTED_PACKET_LENGTH) | ||
806 | if (GNUTLS_E_UNEXPECTED_PACKET_LENGTH == ret) | ||
807 | return MHD_ERR_CONNRESET_; | ||
808 | #endif /* GNUTLS_E_UNEXPECTED_PACKET_LENGTH */ | ||
804 | if (GNUTLS_E_MEMORY_ERROR == ret) | 809 | if (GNUTLS_E_MEMORY_ERROR == ret) |
805 | return MHD_ERR_NOMEM_; | 810 | return MHD_ERR_NOMEM_; |
806 | if (ret < 0) | 811 | if (ret < 0) |