aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-06-16 20:40:02 +0200
committerChristian Grothoff <christian@grothoff.org>2020-06-16 20:40:02 +0200
commit11ed3de399e16ca294fd4478596845b444438968 (patch)
treefc1f94f3bf47c08ca13665e90206b3f0edb0a458
parent2abe788d8ab1426b03bdb1d27ca34c60b0a37769 (diff)
downloadlibmicrohttpd-11ed3de399e16ca294fd4478596845b444438968.tar.gz
libmicrohttpd-11ed3de399e16ca294fd4478596845b444438968.zip
send param adapter is dead
-rw-r--r--src/microhttpd/connection.c55
-rw-r--r--src/microhttpd/connection_https.c47
-rw-r--r--src/microhttpd/internal.h5
3 files changed, 0 insertions, 107 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 1fa2ee87..715b2d40 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -231,60 +231,6 @@ recv_param_adapter (struct MHD_Connection *connection,
231 231
232 232
233/** 233/**
234 * Callback for writing data to the socket.
235 *
236 * @param connection the MHD connection structure
237 * @param other data to write
238 * @param i number of bytes to write
239 * @return positive value for number of bytes actually sent or
240 * negative value for error number MHD_ERR_xxx_
241 */
242static ssize_t
243send_param_adapter (struct MHD_Connection *connection,
244 const void *other,
245 size_t i)
246{
247 ssize_t ret;
248
249 if ( (MHD_INVALID_SOCKET == connection->socket_fd) ||
250 (MHD_CONNECTION_CLOSED == connection->state) )
251 {
252 return MHD_ERR_NOTCONN_;
253 }
254 if (i > MHD_SCKT_SEND_MAX_SIZE_)
255 i = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */
256
257 ret = MHD_send_ (connection->socket_fd,
258 other,
259 i);
260 if (0 > ret)
261 {
262 const int err = MHD_socket_get_error_ ();
263
264 if (MHD_SCKT_ERR_IS_EAGAIN_ (err))
265 {
266#ifdef EPOLL_SUPPORT
267 /* EAGAIN --- no longer write-ready */
268 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
269#endif /* EPOLL_SUPPORT */
270 return MHD_ERR_AGAIN_;
271 }
272 if (MHD_SCKT_ERR_IS_EINTR_ (err))
273 return MHD_ERR_AGAIN_;
274 if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_))
275 return MHD_ERR_CONNRESET_;
276 /* Treat any other error as hard error. */
277 return MHD_ERR_NOTCONN_;
278 }
279#ifdef EPOLL_SUPPORT
280 else if (i > (size_t) ret)
281 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
282#endif /* EPOLL_SUPPORT */
283 return ret;
284}
285
286
287/**
288 * Get all of the headers from the request. 234 * Get all of the headers from the request.
289 * 235 *
290 * @param connection connection to get values from 236 * @param connection connection to get values from
@@ -3814,7 +3760,6 @@ void
3814MHD_set_http_callbacks_ (struct MHD_Connection *connection) 3760MHD_set_http_callbacks_ (struct MHD_Connection *connection)
3815{ 3761{
3816 connection->recv_cls = &recv_param_adapter; 3762 connection->recv_cls = &recv_param_adapter;
3817 connection->send_cls = &send_param_adapter;
3818} 3763}
3819 3764
3820 3765
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c
index 79a52b5e..7307d48b 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -91,52 +91,6 @@ recv_tls_adapter (struct MHD_Connection *connection,
91 91
92 92
93/** 93/**
94 * Callback for writing data to the socket.
95 *
96 * @param connection the MHD connection structure
97 * @param other data to write
98 * @param i number of bytes to write
99 * @return positive value for number of bytes actually sent or
100 * negative value for error number MHD_ERR_xxx_
101 */
102ssize_t
103send_tls_adapter (struct MHD_Connection *connection,
104 const void *other,
105 size_t i)
106{
107 ssize_t res;
108
109 if (i > SSIZE_MAX)
110 i = SSIZE_MAX;
111
112 res = gnutls_record_send (connection->tls_session,
113 other,
114 i);
115 if ( (GNUTLS_E_AGAIN == res) ||
116 (GNUTLS_E_INTERRUPTED == res) )
117 {
118#ifdef EPOLL_SUPPORT
119 if (GNUTLS_E_AGAIN == res)
120 connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
121#endif
122 return MHD_ERR_AGAIN_;
123 }
124 if (res < 0)
125 {
126 /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication
127 disrupted); interpret as a hard error */
128 return MHD_ERR_NOTCONN_;
129 }
130#ifdef EPOLL_SUPPORT
131 /* Unlike non-TLS connections, do not reset "write-ready" if
132 * sent amount smaller than provided amount, as TLS
133 * connections may break data into smaller parts for sending. */
134#endif /* EPOLL_SUPPORT */
135 return res;
136}
137
138
139/**
140 * Give gnuTLS chance to work on the TLS handshake. 94 * Give gnuTLS chance to work on the TLS handshake.
141 * 95 *
142 * @param connection connection to handshake on 96 * @param connection connection to handshake on
@@ -192,7 +146,6 @@ void
192MHD_set_https_callbacks (struct MHD_Connection *connection) 146MHD_set_https_callbacks (struct MHD_Connection *connection)
193{ 147{
194 connection->recv_cls = &recv_tls_adapter; 148 connection->recv_cls = &recv_tls_adapter;
195 connection->send_cls = &send_tls_adapter;
196} 149}
197 150
198 151
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 4cec6787..39a7825d 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -962,11 +962,6 @@ struct MHD_Connection
962 */ 962 */
963 ReceiveCallback recv_cls; 963 ReceiveCallback recv_cls;
964 964
965 /**
966 * Function used for writing HTTP response stream.
967 */
968 TransmitCallback send_cls;
969
970#ifdef UPGRADE_SUPPORT 965#ifdef UPGRADE_SUPPORT
971 /** 966 /**
972 * If this connection was upgraded, this points to 967 * If this connection was upgraded, this points to