File: http_server.h

package info (click to toggle)
entropybroker 2.8-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,644 kB
  • ctags: 1,591
  • sloc: cpp: 14,384; sh: 934; makefile: 191; java: 148; perl: 12
file content (25 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#define HTTP_SERVER_READ_SIZE 4096

class http_server
{
private:
	int fd;
	std::vector<std::string> request_headers;
	http_request_t request_type;
	unsigned char *request_data;
	std::string request_url;
	int request_data_size;

	bool send(unsigned char *p, int len);
	bool send(const char *what);

public:
	http_server(int fd);
	~http_server();

	http_request_t get_request_type();
	http_bundle * get_request();
	std::string get_request_url();

	void send_response(int status_code, std::vector<std::string> *headers, http_bundle *response);
};