weighttp/src/client.h

50 lines
924 B
C
Raw Normal View History

2009-09-10 18:09:56 +00:00
/*
* weighttp - a lightweight and simple webserver benchmarking tool
*
* Author:
2011-10-16 10:01:50 +00:00
* Copyright (c) 2009-2011 Thomas Porzelt
2009-09-10 18:09:56 +00:00
*
* License:
* MIT, see COPYING file
*/
struct Client {
enum {
CLIENT_START,
CLIENT_CONNECTING,
CLIENT_WRITING,
CLIENT_READING,
CLIENT_ERROR,
CLIENT_END
} state;
enum {
PARSER_START,
PARSER_HEADER,
PARSER_BODY
} parser_state;
Worker *worker;
ev_io sock_watcher;
uint32_t buffer_offset;
uint32_t parser_offset;
uint32_t request_offset;
ev_tstamp ts_start;
ev_tstamp ts_end;
uint8_t keepalive;
uint8_t success;
uint8_t status_success;
2009-09-30 21:31:03 +00:00
uint8_t chunked;
int64_t chunk_size;
int64_t chunk_received;
2009-09-10 18:09:56 +00:00
int64_t content_length;
uint64_t bytes_received; /* including http header */
uint16_t header_size;
char buffer[CLIENT_BUFFER_SIZE];
};
Client *client_new(Worker *worker);
void client_free(Client *client);
2009-09-10 21:45:34 +00:00
void client_state_machine(Client *client);