-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.h
45 lines (36 loc) · 1.03 KB
/
proxy.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
#ifndef _PROXY__H
#define _PROXY__H
#include <unistd.h>
#include <time.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <list>
#include <iterator>
#include <utility>
#include <thread>
#include <unordered_map>
#include "httpsocket.h"
#include "httprequest.h"
#include "httpresponse.h"
#include "httpsocket.h"
#include "cache.h"
class Proxy{
private:
HttpSocket im_server_sk;
public:
void handle_request(HttpRequest &request,HttpSocket &server,HttpSocket &client, cache &mycache);
Proxy() : im_server_sk("12345") {}
// make the server up and listen.
void compose_up();
// accept client, and connect.
// HttpSocket accept_client();
int accept_client();
HttpRequest recv_request_from(HttpSocket sk);
HttpResponse recv_response_from(HttpSocket sk);
// void send_request_to(HttpSocket sk, HttpRequest req);
// void handle(HttpSocket& client_sk, cache& cache);
void handle(int client_fd, cache& cache);
// std::thread create_thread(int client_fd, cache cache);
};
#endif