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;
The
lews_connection_context_tstruct 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
sThe socket associated with the incoming connection.incoming_bufA buffer containing data read from the socket. Its size is defined by theLEWS_INCOMING_CONNECTION_BUF_SIZEmacro.received_sizeThe size of data read from the socket into the incoming buffer.outgoing_bufA buffer used for accumulating data for the response. Its size is defined by theLEWS_OUTGOING_CONNECTION_BUF_SIZEmacro.filled_sizeThe size of data filled into the outgoing buffer.is_response_sentA flag indicating whether the HTTP response header has been sent.method_posThe position of the method string in the incoming buffer.method_lenThe length of the method string.url_posThe position of the invoked URL in the incoming buffer.url_lenThe length of the URL string.params_posThe position of the GET request parameters strings in the incoming buffer.params_lenThe length of the GET request parameters string.header_posThe position of the string containing the list of HTTP request header values in the incoming buffer.header_lenThe length of the string containing the list of HTTP request header values.data_posThe position of the beginning of the data block in the incoming buffer.data_lenThe length of the data block.