aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/microhttpd/connection.c27
-rw-r--r--src/microhttpd/connection_https.c23
2 files changed, 42 insertions, 8 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 309683b8..916e75c8 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -208,9 +208,19 @@ recv_param_adapter (struct MHD_Connection *connection,
208 } 208 }
209 if (MHD_SCKT_ERR_IS_EINTR_ (err)) 209 if (MHD_SCKT_ERR_IS_EINTR_ (err))
210 return MHD_ERR_AGAIN_; 210 return MHD_ERR_AGAIN_;
211 if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_)) 211 if (MHD_SCKT_ERR_IS_REMOTE_DISCNN_ (err))
212 return MHD_ERR_CONNRESET_; 212 return MHD_ERR_CONNRESET_;
213 /* Treat any other error as hard error. */ 213 if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_EOPNOTSUPP_))
214 return MHD_ERR_OPNOTSUPP_;
215 if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ENOTCONN_))
216 return MHD_ERR_NOTCONN_;
217 if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_EINVAL_))
218 return MHD_ERR_INVAL_;
219 if (MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err))
220 return MHD_ERR_NOMEM_;
221 if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_EBADF_))
222 return MHD_ERR_BADF_;
223 /* Treat any other error as a hard error. */
214 return MHD_ERR_NOTCONN_; 224 return MHD_ERR_NOTCONN_;
215 } 225 }
216#ifdef EPOLL_SUPPORT 226#ifdef EPOLL_SUPPORT
@@ -2852,11 +2862,16 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
2852 "Socket disconnected while reading request.")); 2862 "Socket disconnected while reading request."));
2853 return; 2863 return;
2854 } 2864 }
2865
2866#ifdef HAVE_MESSAGES
2867 if (MHD_CONNECTION_INIT != connection->state)
2868 MHD_DLOG (connection->daemon,
2869 _ ("Connection socket is closed when reading " \
2870 "request due to the error: %s\n"),
2871 str_conn_error_ (bytes_read));
2872#endif
2855 CONNECTION_CLOSE_ERROR (connection, 2873 CONNECTION_CLOSE_ERROR (connection,
2856 (MHD_CONNECTION_INIT == connection->state) ? 2874 NULL);
2857 NULL :
2858 _ (
2859 "Connection socket is closed due to error when reading request."));
2860 return; 2875 return;
2861 } 2876 }
2862 2877
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c
index 3d4b0bdb..0060c59a 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -73,9 +73,28 @@ recv_tls_adapter (struct MHD_Connection *connection,
73 } 73 }
74 if (res < 0) 74 if (res < 0)
75 { 75 {
76 /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication
77 disrupted); interpret as a hard error */
78 connection->tls_read_ready = false; 76 connection->tls_read_ready = false;
77 if ( (GNUTLS_E_DECRYPTION_FAILED == res) ||
78 (GNUTLS_E_INVALID_SESSION == res) ||
79 (GNUTLS_E_DECOMPRESSION_FAILED == res) ||
80 (GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER == res) ||
81 (GNUTLS_E_UNSUPPORTED_VERSION_PACKET == res) ||
82 (GNUTLS_E_UNEXPECTED_PACKET_LENGTH == res) ||
83 (GNUTLS_E_UNEXPECTED_PACKET == res) ||
84 (GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET == res) ||
85 (GNUTLS_E_EXPIRED == res) ||
86 (GNUTLS_E_REHANDSHAKE == res) )
87 return MHD_ERR_TLS_;
88 if ( (GNUTLS_E_PULL_ERROR == res) ||
89 (GNUTLS_E_INTERNAL_ERROR == res) ||
90 (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == res) ||
91 (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == res) )
92 return MHD_ERR_PIPE_;
93 if (GNUTLS_E_PREMATURE_TERMINATION == res)
94 return MHD_ERR_CONNRESET_;
95 if (GNUTLS_E_MEMORY_ERROR == res)
96 return MHD_ERR_NOMEM_;
97 /* Treat any other error as a hard error. */
79 return MHD_ERR_NOTCONN_; 98 return MHD_ERR_NOTCONN_;
80 } 99 }
81 100