scorpioengine/src/client.h

80 lines
1.1 KiB
C
Raw Normal View History

#ifndef headerfile_libscorpiohttpserver_src_client_h
#define headerfile_libscorpiohttpserver_src_client_h
#include <space/space.h>
#define WEBSERVER_INPUT_BUFFER_MAX_LEN 8196
enum HTTPMethod
{
http_method_get = 0,
http_method_post,
http_method_put,
http_method_delete,
http_method_options,
http_method_unsupported
};
enum HTTPVersion
{
http_version_1_0,
http_version_1_1,
http_version_unsupported
};
class Client
{
public:
int socket;
PT::Space in;
std::wstring url;
HTTPMethod http_method;
HTTPVersion http_version;
bool answer_generated;
bool close_connection;
char * in_buffer; // rename to a better name
size_t in_buffer_max_len; // at least two characters
size_t in_buffer_len;
std::string input_buffer;
std::string header;
bool parsing_headers;
bool parsing_first_header;
std::string output_buffer;
size_t output_buffer_sent; // how many characters were sent
Client();
Client(const Client & c);
~Client();
Client & operator=(const Client & c);
void AllocInputBuffer();
void PrepareToNewRequest();
};
#endif