GNU libmicrohttpd  0.9.59
connection_https.c File Reference

Methods for managing SSL/TLS connections. This file is only compiled if ENABLE_HTTPS is set. More...

#include "internal.h"
#include "connection.h"
#include "connection_https.h"
#include "memorypool.h"
#include "response.h"
#include "mhd_mono_clock.h"
#include <gnutls/gnutls.h>
Include dependency graph for connection_https.c:

Go to the source code of this file.

Functions

static ssize_t recv_tls_adapter (struct MHD_Connection *connection, void *other, size_t i)
 
static ssize_t send_tls_adapter (struct MHD_Connection *connection, const void *other, size_t i)
 
bool MHD_run_tls_handshake_ (struct MHD_Connection *connection)
 
void MHD_set_https_callbacks (struct MHD_Connection *connection)
 
bool MHD_tls_connection_shutdown (struct MHD_Connection *connection)
 

Detailed Description

Methods for managing SSL/TLS connections. This file is only compiled if ENABLE_HTTPS is set.

Author
Sagie Amir
Christian Grothoff

Definition in file connection_https.c.

Function Documentation

◆ MHD_run_tls_handshake_()

bool MHD_run_tls_handshake_ ( struct MHD_Connection connection)

Give gnuTLS chance to work on the TLS handshake.

Parameters
connectionconnection to handshake on
Returns
true if the handshake has completed successfully and we should start to read/write data, false is handshake in progress or in case of error

Definition at line 148 of file connection_https.c.

References _, MHD_Connection::daemon, MHD_connection_close_(), MHD_REQUEST_TERMINATED_WITH_ERROR, MHD_TLS_CONN_CONNECTED, MHD_TLS_CONN_HANDSHAKING, MHD_TLS_CONN_INIT, MHD_TLS_CONN_TLS_FAILED, and MHD_update_last_activity_().

Referenced by MHD_connection_handle_read(), and MHD_connection_handle_write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_set_https_callbacks()

void MHD_set_https_callbacks ( struct MHD_Connection connection)

Set connection callback function to be used through out the processing of this secure connection.

Parameters
connectionwhich callbacks should be modified

Definition at line 191 of file connection_https.c.

References MHD_Connection::recv_cls, recv_tls_adapter(), MHD_Connection::send_cls, and send_tls_adapter().

Referenced by internal_add_connection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_tls_connection_shutdown()

bool MHD_tls_connection_shutdown ( struct MHD_Connection connection)

Initiate shutdown of TLS layer of connection.

Parameters
connectionto use
Returns
true if succeed, false otherwise.

Definition at line 205 of file connection_https.c.

References MHD_TLS_CONN_TLS_FAILED, MHD_TLS_CONN_WR_CLOSED, and MHD_TLS_CONN_WR_CLOSING.

Referenced by MHD_connection_mark_closed_().

Here is the caller graph for this function:

◆ recv_tls_adapter()

static ssize_t recv_tls_adapter ( struct MHD_Connection connection,
void *  other,
size_t  i 
)
static

Callback for receiving data from the socket.

Parameters
connectionthe MHD_Connection structure
otherwhere to write received data to
imaximum size of other (in bytes)
Returns
positive value for number of bytes actually received or negative value for error number MHD_ERR_xxx_

Definition at line 48 of file connection_https.c.

References MHD_EPOLL_STATE_READ_READY, MHD_ERR_AGAIN_, and MHD_ERR_NOTCONN_.

Referenced by MHD_set_https_callbacks().

Here is the caller graph for this function:

◆ send_tls_adapter()

static ssize_t send_tls_adapter ( struct MHD_Connection connection,
const void *  other,
size_t  i 
)
static

Callback for writing data to the socket.

Parameters
connectionthe MHD connection structure
otherdata to write
inumber of bytes to write
Returns
positive value for number of bytes actually sent or negative value for error number MHD_ERR_xxx_

Definition at line 102 of file connection_https.c.

References MHD_EPOLL_STATE_WRITE_READY, MHD_ERR_AGAIN_, and MHD_ERR_NOTCONN_.

Referenced by MHD_set_https_callbacks().

Here is the caller graph for this function: