You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.2 KiB

#error Please include <lighttpd/base.h> instead of this file
typedef enum {
/** unused */
/** waiting for new input after first request */
/** after the connect, the request is initialized */
/** loop in the read-request-header until the full header is received */
/** handle in main virtual request */
/** write remaining bytes from raw_out, mainvr finished (or not started) */
} liConnectionState;
struct liConnection {
guint idx; /** index in connection table */
liServer *srv;
liWorker *wrk;
liServerSocket *srv_sock;
gpointer srv_sock_data; /** private data for custom sockets (ssl) */
liConInfo info;
liConnectionState state;
gboolean response_headers_sent, expect_100_cont;
liChunkQueue *raw_in, *raw_out;
liChunkQueue *in, *out; /* link to mainvr->in/out */
liBuffer *raw_in_buffer;
liVRequest *mainvr;
liHttpRequestCtx req_parser_ctx;
ev_tstamp ts_started; /* when connection was started, not a (v)request */
/* Keep alive timeout data */
struct {
GList *link;
ev_tstamp timeout;
guint max_idle;
ev_timer watcher;
} keep_alive_data;
guint keep_alive_requests;
ev_io sock_watcher;
gboolean can_read, can_write;
/* I/O timeout data */
liWaitQueueElem io_timeout_elem;
/* Internal functions */
LI_API liConnection* li_connection_new(liWorker *wrk);
/** Free dead connections */
LI_API void li_connection_free(liConnection *con);
/** close connection */
LI_API void li_connection_reset(liConnection *con);
/** aborts an active connection, calls all plugin cleanup handlers */
LI_API void li_connection_error(liConnection *con); /* used in worker.c */
LI_API void li_connection_start(liConnection *con, liSocketAddress remote_addr, int s, liServerSocket *srv_sock);
/* public function */
LI_API gchar *li_connection_state_str(liConnectionState state);
/* returns NULL if the vrequest doesn't belong to a liConnection* object */
LI_API liConnection* li_connection_from_vrequest(liVRequest *vr);
LI_API void connection_handle_io(liConnection *con);