forked from s4mu313/webcam-http-streamer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreq_res.h
53 lines (39 loc) · 870 Bytes
/
req_res.h
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
48
49
50
51
52
53
#ifndef REQ_RES_H
#define REQ_RES_H
#include <string>
#include <vector>
#include "support.h"
struct Request
{
server_impl::Headers headers;
server_impl::Params query;
std::string path;
Request(std::string p)
: path(p)
{}
};
struct Response
{
int client;
server_impl::Headers headers;
Response(int clt)
: client(clt), headers { "HTTP/1.1 200 OK" }
{}
bool
write(std::string msg) const
{
return server_impl::send_h(client, headers)
&& server_impl::send_m(client, msg);
}
bool
send_header() const
{ return server_impl::send_h(client, headers); }
bool
send_msg(std::string msg) const
{ return server_impl::send_m(client, msg); }
};
void
operator>>(const Response& res,
const std::string& msg)
{ res.write(msg); }
#endif // REQ_RES_H