GNU libmicrohttpd
0.9.29
|
Methods for managing connections. More...
#include "internal.h"
Go to the source code of this file.
Macros | |
#define | MHD_connection_finish_forward_(conn) (void)conn |
Functions | |
void | MHD_set_http_callbacks_ (struct MHD_Connection *connection) |
int | MHD_connection_handle_read (struct MHD_Connection *connection) |
int | MHD_connection_handle_write (struct MHD_Connection *connection) |
int | MHD_connection_handle_idle (struct MHD_Connection *connection) |
void | MHD_connection_mark_closed_ (struct MHD_Connection *connection) |
void | MHD_connection_close_ (struct MHD_Connection *connection, enum MHD_RequestTerminationCode termination_code) |
void | MHD_update_last_activity_ (struct MHD_Connection *connection) |
Methods for managing connections.
Definition in file connection.h.
#define MHD_connection_finish_forward_ | ( | conn | ) | (void)conn |
Definition at line 120 of file connection.h.
Referenced by call_handlers(), close_all_connections(), internal_run_from_select(), MHD_connection_close_(), MHD_poll(), and MHD_select().
void MHD_connection_close_ | ( | struct MHD_Connection * | connection, |
enum MHD_RequestTerminationCode | termination_code | ||
) |
Close the given connection and give the specified termination code to the user.
connection | connection to close |
termination_code | termination reason to give |
Definition at line 592 of file connection.c.
References _, MHD_Connection::client_aware, MHD_Connection::client_context, MHD_Connection::daemon, DLL_remove, EDLL_remove, MHD_connection_finish_forward_, MHD_connection_mark_closed_(), MHD_destroy_response(), MHD_INVALID_SOCKET, MHD_PANIC, MHD_USE_EPOLL, MHD_USE_THREAD_PER_CONNECTION, MHD_USE_TLS, MHD_Daemon::notify_completed, MHD_Daemon::notify_completed_cls, NULL, MHD_Daemon::options, MHD_Connection::response, and MHD_Connection::socket_fd.
Referenced by call_handlers(), close_connection(), connection_close_error(), do_read(), MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_tls_connection_handle_idle(), run_tls_handshake(), thread_main_handle_connection(), and try_ready_normal_body().
int MHD_connection_handle_idle | ( | struct MHD_Connection * | connection | ) |
This function was created to handle per-connection processing that has to happen even if the socket cannot be read or written to. All implementations (multithreaded, external select, internal select) call this function.
connection | connection to handle |
This function was created to handle per-connection processing that has to happen even if the socket cannot be read or written to.
connection | connection to handle |
Definition at line 2895 of file connection.c.
References _, build_header_response(), call_connection_handler(), cleanup_connection(), MHD_Connection::client_aware, MHD_Connection::client_context, MHD_Connection::colon, CONNECTION_CLOSE_ERROR, MHD_Connection::connection_timeout, MHD_Connection::continue_message_write_offset, MHD_Response::crc, MHD_Connection::current_chunk_offset, MHD_Connection::current_chunk_size, MHD_Connection::daemon, MHD_Connection::event_loop_info, EXTRA_CHECK, get_next_header_line(), MHD_Connection::have_chunked_upload, MHD_Connection::header_size, MHD_Connection::headers_received, MHD_Connection::headers_received_tail, HTTP_100_CONTINUE, MHD_Connection::in_idle, MHD_Connection::keepalive, MHD_Connection::last, MHD_Connection::last_activity, MHD_Connection::method, MHD_CONN_KEEPALIVE_UNKOWN, MHD_CONN_USE_KEEPALIVE, MHD_CONNECTION_BODY_RECEIVED, MHD_CONNECTION_BODY_SENT, MHD_CONNECTION_CHUNKED_BODY_READY, MHD_CONNECTION_CHUNKED_BODY_UNREADY, MHD_connection_close_(), MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_FOOTERS_SENDING, MHD_CONNECTION_FOOTERS_SENT, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_HEADERS_SENDING, MHD_CONNECTION_HEADERS_SENT, MHD_CONNECTION_INIT, MHD_CONNECTION_NORMAL_BODY_READY, MHD_CONNECTION_NORMAL_BODY_UNREADY, MHD_connection_update_event_loop_info(), MHD_CONNECTION_URL_RECEIVED, MHD_destroy_response(), MHD_EPOLL_STATE_IN_EPOLL_SET, MHD_EPOLL_STATE_READ_READY, MHD_EPOLL_STATE_SUSPENDED, MHD_EPOLL_STATE_WRITE_READY, MHD_EVENT_LOOP_INFO_READ, MHD_EVENT_LOOP_INFO_WRITE, MHD_FOOTER_KIND, MHD_HEADER_KIND, MHD_HTTP_BAD_REQUEST, MHD_HTTP_METHOD_POST, MHD_HTTP_METHOD_PUT, MHD_HTTP_PROCESSING, MHD_monotonic_sec_counter(), MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_NO, MHD_pool_destroy(), MHD_pool_reset(), MHD_REQUEST_TERMINATED_COMPLETED_OK, MHD_REQUEST_TERMINATED_TIMEOUT_REACHED, MHD_response_execute_upgrade_(), MHD_SIZE_UNKNOWN, MHD_socket_last_strerr_, MHD_STATICSTR_LEN_, MHD_str_equal_caseless_(), MHD_USE_EPOLL, MHD_USE_ERROR_LOG, MHD_YES, MHD_Response::mutex, need_100_continue(), MHD_Daemon::notify_completed, MHD_Daemon::notify_completed_cls, NULL, MHD_Daemon::options, parse_connection_headers(), parse_initial_message_line(), MHD_Connection::pool, MHD_Daemon::pool_size, process_broken_line(), process_header_line(), process_request_body(), MHD_Connection::read_buffer, MHD_Connection::read_buffer_offset, MHD_Connection::read_buffer_size, MHD_Connection::read_closed, MHD_Connection::remaining_upload_size, REQUEST_MALFORMED, MHD_Connection::response, MHD_Connection::response_write_position, MHD_Connection::responseCode, MHD_Connection::socket_fd, socket_flush_possible(), socket_start_extra_buffering(), socket_start_no_buffering(), socket_start_no_buffering_flush(), socket_start_normal_buffering(), MHD_Connection::state, MHD_Connection::suspended, MHD_Response::total_size, transmit_error_response(), try_ready_chunked_body(), try_ready_normal_body(), MHD_Connection::url, MHD_Connection::version, MHD_Connection::write_buffer, MHD_Connection::write_buffer_append_offset, MHD_Connection::write_buffer_send_offset, and MHD_Connection::write_buffer_size.
Referenced by MHD_queue_response(), MHD_set_http_callbacks_(), MHD_tls_connection_handle_idle(), and thread_main_handle_connection().
int MHD_connection_handle_read | ( | struct MHD_Connection * | connection | ) |
This function handles a particular connection when it has been determined that there is data to be read off a socket. All implementations (multithreaded, external select, internal select) call this function to handle reads.
connection | connection to handle |
This function handles a particular connection when it has been determined that there is data to be read off a socket.
connection | connection to handle |
Definition at line 2560 of file connection.c.
References _, MHD_Connection::daemon, do_read(), EXTRA_CHECK, MHD_CONNECTION_BODY_RECEIVED, MHD_connection_close_(), MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_INIT, MHD_CONNECTION_URL_RECEIVED, MHD_NO, MHD_pool_reallocate(), MHD_REQUEST_TERMINATED_READ_ERROR, MHD_update_last_activity_(), MHD_YES, MHD_Connection::pool, MHD_Daemon::pool_increment, MHD_Connection::read_buffer, MHD_Connection::read_buffer_offset, MHD_Connection::read_buffer_size, MHD_Connection::read_closed, MHD_Connection::state, MHD_Connection::suspended, and try_grow_read_buffer().
Referenced by MHD_set_http_callbacks_(), and MHD_tls_connection_handle_read().
int MHD_connection_handle_write | ( | struct MHD_Connection * | connection | ) |
This function was created to handle writes to sockets when it has been determined that the socket can be written to. All implementations (multithreaded, external select, internal select) call this function
connection | connection to handle |
This function was created to handle writes to sockets when it has been determined that the socket can be written to.
connection | connection to handle |
Definition at line 2630 of file connection.c.
References _, check_write_done(), CONNECTION_CLOSE_ERROR, MHD_Connection::continue_message_write_offset, MHD_Response::crc, MHD_Connection::daemon, MHD_Response::data, MHD_Response::data_size, MHD_Response::data_start, do_write(), EXTRA_CHECK, HTTP_100_CONTINUE, MHD_CONNECTION_BODY_RECEIVED, MHD_CONNECTION_BODY_SENT, MHD_CONNECTION_CHUNKED_BODY_READY, MHD_CONNECTION_CHUNKED_BODY_UNREADY, MHD_CONNECTION_CLOSED, MHD_CONNECTION_CONTINUE_SENDING, MHD_CONNECTION_CONTINUE_SENT, MHD_CONNECTION_FOOTER_PART_RECEIVED, MHD_CONNECTION_FOOTERS_RECEIVED, MHD_CONNECTION_FOOTERS_SENDING, MHD_CONNECTION_FOOTERS_SENT, MHD_CONNECTION_HEADER_PART_RECEIVED, MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_HEADERS_RECEIVED, MHD_CONNECTION_HEADERS_SENDING, MHD_CONNECTION_HEADERS_SENT, MHD_CONNECTION_IN_CLEANUP, MHD_CONNECTION_INIT, MHD_CONNECTION_NORMAL_BODY_READY, MHD_CONNECTION_NORMAL_BODY_UNREADY, MHD_CONNECTION_URL_RECEIVED, MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_NO, MHD_PANIC, MHD_SCKT_ERR_IS_EAGAIN_, MHD_SCKT_ERR_IS_EINTR_, MHD_socket_get_error_, MHD_socket_strerr_, MHD_STATICSTR_LEN_, MHD_TLS_CONNECTION_INIT, MHD_update_last_activity_(), MHD_YES, MHD_Response::mutex, NULL, MHD_Connection::response, MHD_Connection::response_write_position, MHD_Connection::send_cls, SIZE_MAX, MHD_Connection::state, MHD_Connection::suspended, MHD_Response::total_size, try_ready_normal_body(), and MHD_Connection::url.
Referenced by MHD_set_http_callbacks_(), and MHD_tls_connection_handle_write().
void MHD_connection_mark_closed_ | ( | struct MHD_Connection * | connection | ) |
Mark connection as "closed".
connection | connection to close |
Definition at line 554 of file connection.c.
References MHD_Connection::daemon, MHD_Connection::event_loop_info, MHD_CONNECTION_CLOSED, MHD_EVENT_LOOP_INFO_CLEANUP, MHD_NO, MHD_tls_connection_shutdown(), MHD_USE_TLS, MHD_USE_TURBO, MHD_Daemon::options, MHD_Daemon::shutdown, MHD_Connection::socket_fd, and MHD_Connection::state.
Referenced by close_connection(), and MHD_connection_close_().
void MHD_set_http_callbacks_ | ( | struct MHD_Connection * | connection | ) |
Set callbacks for this connection to those for HTTP.
connection | connection to initialize |
Definition at line 3439 of file connection.c.
References MHD_Connection::idle_handler, MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_connection_handle_write(), MHD_Connection::read_handler, and MHD_Connection::write_handler.
Referenced by internal_add_connection().
void MHD_update_last_activity_ | ( | struct MHD_Connection * | connection | ) |
Update the 'last_activity' field of the connection to the current time and move the connection to the head of the 'normal_timeout' list if the timeout for the connection uses the default value.
connection | the connection that saw some activity |
Definition at line 2522 of file connection.c.
References MHD_Daemon::cleanup_connection_mutex, MHD_Connection::connection_timeout, MHD_Daemon::connection_timeout, MHD_Connection::daemon, MHD_Connection::last_activity, MHD_monotonic_sec_counter(), MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_USE_THREAD_PER_CONNECTION, MHD_Daemon::normal_timeout_head, MHD_Daemon::normal_timeout_tail, MHD_Daemon::options, MHD_Connection::suspended, XDLL_insert, and XDLL_remove.
Referenced by MHD_connection_handle_read(), MHD_connection_handle_write(), run_tls_handshake(), and thread_main_handle_connection().