lews_connection_context_t

Prototype

    typedef struct lews_connection_context_t_ {
        mco_socket_t *s;

    #ifdef MCOEWSLITE_USE_STATIC_BUFFERS
        char *incoming_buf;
    #else
        char incoming_buf[LEWS_INCOMING_CONNECTION_BUF_SIZE];
    #endif
        mco_size_sig_t received_size;

    #ifdef MCOEWSLITE_USE_STATIC_BUFFERS
        char *outgoing_buf;
    #else
        char outgoing_buf[LEWS_OUTGOING_CONNECTION_BUF_SIZE];
    #endif
        mco_size_sig_t filled_size;
        mco_bool is_response_sent;
        mco_uint2 method_pos;
        mco_uint2 method_len;
        mco_uint2 url_pos;
        mco_uint2 url_len;
        mco_uint2 params_pos;
        mco_uint2 params_len;
        mco_uint2 header_pos;
        mco_uint2 header_len;
        mco_uint2 data_pos;
        mco_uint2 data_len;
    } lews_connection_context_t, *lews_connection_context_h;

Description

The lews_connection_context_t struct encapsulates the context associated with a web server connection. It holds incoming and outgoing web server connection buffers, along with information extracted from the parsed HTTP request.

Fields

s
The socket associated with the incoming connection.
incoming_buf
A buffer containing data read from the socket. Its size is defined by the LEWS_INCOMING_CONNECTION_BUF_SIZE macro.
received_size
The size of data read from the socket into the incoming buffer.
outgoing_buf
A buffer used for accumulating data for the response. Its size is defined by the LEWS_OUTGOING_CONNECTION_BUF_SIZE macro.
filled_size
The size of data filled into the outgoing buffer.
is_response_sent
A flag indicating whether the HTTP response header has been sent.
method_pos
The position of the method string in the incoming buffer.
method_len
The length of the method string.
url_pos
The position of the invoked URL in the incoming buffer.
url_len
The length of the URL string.
params_pos
The position of the GET request parameters strings in the incoming buffer.
params_len
The length of the GET request parameters string.
header_pos
The position of the string containing the list of HTTP request header values in the incoming buffer.
header_len
The length of the string containing the list of HTTP request header values.
data_pos
The position of the beginning of the data block in the incoming buffer.
data_len
The length of the data block.

Files

Header file:
mcoewslite.h
Source file:
mcoewslite.c
Library:
mcoewslite.a