-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTTPHandler.h
More file actions
47 lines (34 loc) · 933 Bytes
/
HTTPHandler.h
File metadata and controls
47 lines (34 loc) · 933 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Created by lupusanay on 28.12.17.
//
#ifndef HIGHLOAD_SERVER_HTTPHANDLER_H
#define HIGHLOAD_SERVER_HTTPHANDLER_H
#include <boost/asio.hpp>
#include <iostream>
#include <boost/regex.hpp>
#include "Data.h"
using namespace std;
using namespace boost::asio;
class HTTPHandler {
public:
explicit HTTPHandler(const string &requestData);
string getResponse();
private:
struct Request {
string method;
string request_target;
string http_version;
vector<string> headers;
string body;
} request;
string response = "HTTP/1.1 200 OK\r\n"
"Server: Custom/0.0.1\r\n"
"Content-Type: text/html\r\n"
"Connection: close\r\n"
"Accept-Ranges: bytes\r\n\r\n"
"Hello everyone, it's my new web server!";
void createResponse();
void notFound();
void badRequest();
};
#endif //HIGHLOAD_SERVER_HTTPHANDLER_H