request_parser.h 703 Bytes
#ifndef __HTTP_REQUEST_PARSER_H__
#define __HTTP_REQUEST_PARSER_H__

#include "cclass.h"
#include "server.h"
#include "http/request.h"
#include "http/request_queue.h"

#define HTTP_REQUEST_PARSER_READ_CHUNK	1024

#define HTTP_REQUEST_PARSER_START				0
#define HTTP_REQUEST_PARSER_REQUEST_LINE_DONE	1
#define HTTP_REQUEST_PARSER_HEADERS_DONE		2
#define HTTP_REQUEST_PARSER_DONE				3


CLASS(HTTP_REQUEST_PARSER) {
	server_read_hook   get_data;

	char *             buffer;
	size_t             buffer_used;

	HTTP_REQUEST_QUEUE request_queue;

	unsigned char      state;
};

void http_request_parser_parse(const char * buffer, size_t size);

#endif /* __HTTP_REQUEST_PARSER_H__ */

// vim: set ts=4 sw=4: