MHD_Connection Struct Reference

#include <internal.h>


Data Fields

MHD_Connectionnext
MHD_Daemondaemon
MHD_HTTP_Headerheaders_received
MHD_Responseresponse
MemoryPool * pool
void * client_context
char * method
char * url
char * version
char * read_buffer
char * write_buffer
char * last
char * colon
sockaddr_in * addr
pthread_t pid
size_t read_buffer_size
size_t read_buffer_offset
size_t write_buffer_size
size_t write_buffer_send_offset
size_t write_buffer_append_offset
size_t remaining_upload_size
size_t response_write_position
size_t continue_message_write_offset
socklen_t addr_len
time_t last_activity
int socket_fd
int read_closed
enum MHD_CONNECTION_STATE state
unsigned int responseCode
int response_unready
int have_chunked_response
int have_chunked_upload
unsigned int current_chunk_size
unsigned int current_chunk_offset
int(* read_handler )(struct MHD_Connection *connection)
int(* write_handler )(struct MHD_Connection *connection)
int(* idle_handler )(struct MHD_Connection *connection)
ReceiveCallback recv_cls
TransmitCallback send_cls


Detailed Description

Definition at line 333 of file internal.h.


Field Documentation

struct MHD_Connection* MHD_Connection::next

This is a linked list.

Definition at line 339 of file internal.h.

Referenced by MHD_accept_connection(), MHD_cleanup_connections(), MHD_get_timeout(), and MHD_select().

struct MHD_Daemon* MHD_Connection::daemon

Reference to the MHD_Daemon struct.

Definition at line 344 of file internal.h.

Referenced by build_header_response(), call_connection_handler(), connection_add_header(), do_read(), do_write(), MHD_accept_connection(), MHD_cleanup_connections(), MHD_connection_close(), MHD_connection_get_fdset(), MHD_connection_handle_idle(), MHD_connection_handle_write(), MHD_get_fdset(), MHD_get_timeout(), MHD_handle_connection(), MHD_tls_connection_handle_idle(), MHD_tls_connection_handle_read(), MHD_tls_connection_handle_write(), parse_connection_headers(), parse_cookie_header(), parse_initial_message_line(), process_header_line(), transmit_error_response(), try_ready_chunked_body(), and try_ready_normal_body().

struct MHD_HTTP_Header* MHD_Connection::headers_received

Linked list of parsed headers.

Definition at line 349 of file internal.h.

Referenced by connection_add_header(), MHD_get_connection_values(), MHD_lookup_connection_value(), MHD_set_connection_value(), and test_simple_large().

struct MHD_Response* MHD_Connection::response

Response to transmit (initially NULL).

Definition at line 354 of file internal.h.

Referenced by add_extra_headers(), build_header_response(), call_connection_handler(), MHD_cleanup_connections(), MHD_connection_handle_write(), MHD_queue_response(), need_100_continue(), transmit_error_response(), try_ready_chunked_body(), and try_ready_normal_body().

struct MemoryPool* MHD_Connection::pool

The memory pool is created whenever we first read from the TCP stream and destroyed at the end of each request (and re-created for the next request). In the meantime, this pointer is NULL. The pool is used for all connection-related data except for the response (which maybe shared between connections) and the IP address (which persists across individual requests).

Definition at line 366 of file internal.h.

Referenced by build_header_response(), check_write_done(), connection_add_header(), get_next_header_line(), MHD_accept_connection(), MHD_cleanup_connections(), MHD_connection_get_fdset(), MHD_set_connection_value(), parse_cookie_header(), process_broken_line(), try_grow_read_buffer(), and try_ready_chunked_body().

void* MHD_Connection::client_context

We allow the main application to associate some pointer with the connection. Here is where we store it. (MHD does not know or care what it is).

Definition at line 374 of file internal.h.

Referenced by call_connection_handler(), MHD_connection_close(), and parse_initial_message_line().

char* MHD_Connection::method

Request method. Should be GET/POST/etc. Allocated in pool.

Definition at line 380 of file internal.h.

Referenced by call_connection_handler(), MHD_queue_response(), and parse_initial_message_line().

char* MHD_Connection::url

Requested URL (everything after "GET" only). Allocated in pool.

Definition at line 386 of file internal.h.

Referenced by call_connection_handler(), and parse_initial_message_line().

char* MHD_Connection::version

HTTP version string (i.e. http/1.1). Allocated in pool.

Definition at line 392 of file internal.h.

Referenced by add_extra_headers(), call_connection_handler(), MHD_get_connection_info(), MHD_queue_response(), need_100_continue(), parse_connection_headers(), and parse_initial_message_line().

char* MHD_Connection::read_buffer

Buffer for reading requests. Allocated in pool. Actually one byte larger than read_buffer_size (if non-NULL) to allow for 0-termination.

Definition at line 400 of file internal.h.

Referenced by call_connection_handler(), do_read(), get_next_header_line(), and try_grow_read_buffer().

char* MHD_Connection::write_buffer

Buffer for writing response (headers only). Allocated in pool.

Definition at line 406 of file internal.h.

Referenced by build_header_response(), check_write_done(), do_write(), and try_ready_chunked_body().

char* MHD_Connection::last

Last incomplete header line during parsing of headers. Allocated in pool. Only valid if state is either HEADER_PART_RECEIVED or FOOTER_PART_RECEIVED.

Definition at line 413 of file internal.h.

Referenced by process_broken_line(), and process_header_line().

char* MHD_Connection::colon

Position after the colon on the last incomplete header line during parsing of headers. Allocated in pool. Only valid if state is either HEADER_PART_RECEIVED or FOOTER_PART_RECEIVED.

Definition at line 421 of file internal.h.

Referenced by process_broken_line(), and process_header_line().

struct sockaddr_in* MHD_Connection::addr

Foreign address (of length addr_len). MALLOCED (not in pool!).

Definition at line 427 of file internal.h.

Referenced by MHD_accept_connection(), and MHD_cleanup_connections().

pthread_t MHD_Connection::pid

Thread for this connection (if we are using one thread per connection).

Definition at line 433 of file internal.h.

Referenced by MHD_accept_connection(), and MHD_cleanup_connections().

size_t MHD_Connection::read_buffer_size

Size of read_buffer (in bytes). This value indicates how many bytes we're willing to read into the buffer; the real buffer is one byte longer to allow for adding zero-termination (when needed).

Definition at line 441 of file internal.h.

Referenced by do_read(), get_next_header_line(), MHD_connection_get_fdset(), and try_grow_read_buffer().

size_t MHD_Connection::read_buffer_offset

Position where we currently append data in read_buffer (last valid position).

Definition at line 447 of file internal.h.

Referenced by call_connection_handler(), do_read(), get_next_header_line(), and MHD_connection_get_fdset().

size_t MHD_Connection::write_buffer_size

Size of write_buffer (in bytes).

Definition at line 452 of file internal.h.

Referenced by build_header_response(), check_write_done(), and try_ready_chunked_body().

size_t MHD_Connection::write_buffer_send_offset

Offset where we are with sending from write_buffer.

Definition at line 457 of file internal.h.

Referenced by build_header_response(), check_write_done(), do_write(), and try_ready_chunked_body().

size_t MHD_Connection::write_buffer_append_offset

Last valid location in write_buffer (where do we append and up to where is it safe to send?)

Definition at line 463 of file internal.h.

Referenced by build_header_response(), check_write_done(), do_write(), and try_ready_chunked_body().

size_t MHD_Connection::remaining_upload_size

How many more bytes of the body do we expect to read? "-1" for unknown.

Definition at line 469 of file internal.h.

Referenced by call_connection_handler(), and parse_connection_headers().

size_t MHD_Connection::response_write_position

Current write position in the actual response (excluding headers, content only; should be 0 while sending headers).

Definition at line 476 of file internal.h.

Referenced by MHD_queue_response(), try_ready_chunked_body(), and try_ready_normal_body().

size_t MHD_Connection::continue_message_write_offset

Position in the 100 CONTINUE message that we need to send when receiving http 1.1 requests.

Definition at line 482 of file internal.h.

Referenced by MHD_connection_handle_write(), and need_100_continue().

socklen_t MHD_Connection::addr_len

Length of the foreign address.

Definition at line 487 of file internal.h.

Referenced by MHD_accept_connection().

time_t MHD_Connection::last_activity

Last time this connection had any activity (reading or writing).

Definition at line 493 of file internal.h.

Referenced by MHD_accept_connection(), MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_connection_handle_write(), MHD_get_timeout(), MHD_handle_connection(), MHD_tls_connection_handle_idle(), MHD_tls_connection_handle_read(), and MHD_tls_connection_handle_write().

int MHD_Connection::socket_fd

Socket for this connection. Set to -1 if this connection has died (daemon should clean up in that case).

Definition at line 500 of file internal.h.

Referenced by do_read(), MHD_accept_connection(), MHD_cleanup_connections(), MHD_connection_close(), MHD_connection_get_fdset(), MHD_connection_handle_idle(), MHD_handle_connection(), MHD_queue_response(), MHD_select(), MHD_stop_daemon(), MHD_tls_connection_handle_idle(), MHD_tls_connection_handle_read(), recv_param_adapter(), and send_param_adapter().

int MHD_Connection::read_closed

Has this socket been closed for reading (i.e. other side closed the connection)? If so, we must completely close the connection once we are done sending our response (and stop trying to read from this socket).

Definition at line 509 of file internal.h.

Referenced by do_read(), MHD_connection_get_fdset(), MHD_connection_handle_idle(), MHD_queue_response(), parse_connection_headers(), and transmit_error_response().

enum MHD_CONNECTION_STATE MHD_Connection::state

State in the FSM for this connection.

Definition at line 514 of file internal.h.

Referenced by build_header_response(), check_write_done(), MHD_accept_connection(), MHD_connection_close(), MHD_connection_get_fdset(), MHD_connection_handle_idle(), MHD_connection_handle_read(), MHD_connection_handle_write(), MHD_handle_connection(), MHD_queue_response(), MHD_tls_connection_handle_idle(), MHD_tls_connection_handle_read(), MHD_tls_connection_handle_write(), parse_connection_headers(), process_header_line(), transmit_error_response(), and try_ready_chunked_body().

unsigned int MHD_Connection::responseCode

HTTP response code. Only valid if response object is already set.

Definition at line 520 of file internal.h.

Referenced by MHD_queue_response().

int MHD_Connection::response_unready

Set to MHD_YES if the response's content reader callback failed to provide data the last time we tried to read from it. In that case, the write socket should be marked as unready until the CRC call succeeds.

Definition at line 529 of file internal.h.

int MHD_Connection::have_chunked_response

Are we sending with chunked encoding?

Definition at line 534 of file internal.h.

Referenced by MHD_queue_response().

int MHD_Connection::have_chunked_upload

Are we receiving with chunked encoding? This will be set to MHD_YES after we parse the headers and are processing the body with chunks. After we are done with the body and we are processing the footers; once the footers are also done, this will be set to MHD_NO again (before the final call to the handler).

Definition at line 543 of file internal.h.

Referenced by add_extra_headers(), and call_connection_handler().

unsigned int MHD_Connection::current_chunk_size

If we are receiving with chunked encoding, where are we right now? Set to 0 if we are waiting to receive the chunk size; otherwise, this is the size of the current chunk. A value of zero is also used when we're at the end of the chunks.

Definition at line 551 of file internal.h.

Referenced by call_connection_handler().

unsigned int MHD_Connection::current_chunk_offset

If we are receiving with chunked encoding, where are we currently with respect to the current chunk (at what offset / position)?

Definition at line 557 of file internal.h.

Referenced by call_connection_handler().

int(* MHD_Connection::read_handler)(struct MHD_Connection *connection)

Referenced by MHD_handle_connection(), MHD_select(), MHD_set_http_calbacks(), and MHD_set_https_calbacks().

int(* MHD_Connection::write_handler)(struct MHD_Connection *connection)

Referenced by MHD_set_http_calbacks(), and MHD_set_https_calbacks().

int(* MHD_Connection::idle_handler)(struct MHD_Connection *connection)

Referenced by MHD_set_http_calbacks(), and MHD_set_https_calbacks().

ReceiveCallback MHD_Connection::recv_cls

Definition at line 566 of file internal.h.

Referenced by do_read(), and MHD_accept_connection().

TransmitCallback MHD_Connection::send_cls

Definition at line 568 of file internal.h.

Referenced by do_write(), MHD_accept_connection(), and MHD_connection_handle_write().


The documentation for this struct was generated from the following file:
Generated on Sun Nov 16 17:00:21 2008 for GNU libmicrohttpd by  doxygen 1.5.1