Forráskód Böngészése

send param adapter is dead

Christian Grothoff 5 éve
szülő
commit
11ed3de399

+ 0 - 55
src/microhttpd/connection.c

@@ -230,60 +230,6 @@ recv_param_adapter (struct MHD_Connection *connection,
 }
 
 
-/**
- * Callback for writing data to the socket.
- *
- * @param connection the MHD connection structure
- * @param other data to write
- * @param i number of bytes to write
- * @return positive value for number of bytes actually sent or
- *         negative value for error number MHD_ERR_xxx_
- */
-static ssize_t
-send_param_adapter (struct MHD_Connection *connection,
-                    const void *other,
-                    size_t i)
-{
-  ssize_t ret;
-
-  if ( (MHD_INVALID_SOCKET == connection->socket_fd) ||
-       (MHD_CONNECTION_CLOSED == connection->state) )
-  {
-    return MHD_ERR_NOTCONN_;
-  }
-  if (i > MHD_SCKT_SEND_MAX_SIZE_)
-    i = MHD_SCKT_SEND_MAX_SIZE_; /* return value limit */
-
-  ret = MHD_send_ (connection->socket_fd,
-                   other,
-                   i);
-  if (0 > ret)
-  {
-    const int err = MHD_socket_get_error_ ();
-
-    if (MHD_SCKT_ERR_IS_EAGAIN_ (err))
-    {
-#ifdef EPOLL_SUPPORT
-      /* EAGAIN --- no longer write-ready */
-      connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
-#endif /* EPOLL_SUPPORT */
-      return MHD_ERR_AGAIN_;
-    }
-    if (MHD_SCKT_ERR_IS_EINTR_ (err))
-      return MHD_ERR_AGAIN_;
-    if (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_ECONNRESET_))
-      return MHD_ERR_CONNRESET_;
-    /* Treat any other error as hard error. */
-    return MHD_ERR_NOTCONN_;
-  }
-#ifdef EPOLL_SUPPORT
-  else if (i > (size_t) ret)
-    connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
-#endif /* EPOLL_SUPPORT */
-  return ret;
-}
-
-
 /**
  * Get all of the headers from the request.
  *
@@ -3814,7 +3760,6 @@ void
 MHD_set_http_callbacks_ (struct MHD_Connection *connection)
 {
   connection->recv_cls = &recv_param_adapter;
-  connection->send_cls = &send_param_adapter;
 }
 
 

+ 0 - 47
src/microhttpd/connection_https.c

@@ -90,52 +90,6 @@ recv_tls_adapter (struct MHD_Connection *connection,
 }
 
 
-/**
- * Callback for writing data to the socket.
- *
- * @param connection the MHD connection structure
- * @param other data to write
- * @param i number of bytes to write
- * @return positive value for number of bytes actually sent or
- *         negative value for error number MHD_ERR_xxx_
- */
-ssize_t
-send_tls_adapter (struct MHD_Connection *connection,
-                  const void *other,
-                  size_t i)
-{
-  ssize_t res;
-
-  if (i > SSIZE_MAX)
-    i = SSIZE_MAX;
-
-  res = gnutls_record_send (connection->tls_session,
-                            other,
-                            i);
-  if ( (GNUTLS_E_AGAIN == res) ||
-       (GNUTLS_E_INTERRUPTED == res) )
-  {
-#ifdef EPOLL_SUPPORT
-    if (GNUTLS_E_AGAIN == res)
-      connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
-#endif
-    return MHD_ERR_AGAIN_;
-  }
-  if (res < 0)
-  {
-    /* Likely 'GNUTLS_E_INVALID_SESSION' (client communication
-       disrupted); interpret as a hard error */
-    return MHD_ERR_NOTCONN_;
-  }
-#ifdef EPOLL_SUPPORT
-  /* Unlike non-TLS connections, do not reset "write-ready" if
-   * sent amount smaller than provided amount, as TLS
-   * connections may break data into smaller parts for sending. */
-#endif /* EPOLL_SUPPORT */
-  return res;
-}
-
-
 /**
  * Give gnuTLS chance to work on the TLS handshake.
  *
@@ -192,7 +146,6 @@ void
 MHD_set_https_callbacks (struct MHD_Connection *connection)
 {
   connection->recv_cls = &recv_tls_adapter;
-  connection->send_cls = &send_tls_adapter;
 }
 
 

+ 0 - 5
src/microhttpd/internal.h

@@ -962,11 +962,6 @@ struct MHD_Connection
    */
   ReceiveCallback recv_cls;
 
-  /**
-   * Function used for writing HTTP response stream.
-   */
-  TransmitCallback send_cls;
-
 #ifdef UPGRADE_SUPPORT
   /**
    * If this connection was upgraded, this points to