|
5 | 5 |
|
6 | 6 | static const char *user_agent_hdr = "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120305 Firefox/10.0.3\r\n";
|
7 | 7 |
|
| 8 | +/* Proxy/client and proxy/server functions prototypes */ |
| 9 | +static void serve_client(int connfd, cache_line_t *cache); |
| 10 | +static void service_from_cache(int connfd, cache_line_t *cache, size_t matched_line_idx); |
| 11 | +static void service_from_server(int connfd, URL_INFO url_info, char *parsed_request, |
| 12 | + cache_line_t *cache, size_t HTTP_request_hash); |
| 13 | +static int connect_server(URL_INFO url_info, char *parsed_request, int connfd, char *cache_buf); |
| 14 | + |
| 15 | +/* Manipulating HTTP requests functions prototypes */ |
| 16 | +static int read_HTTP_request(int connfd, URL_INFO *url_infop, char *headers); |
| 17 | +static int read_request_line(rio_t *rp, URL_INFO *url_infop, char *parsed_request); |
| 18 | +static void read_request_headers(rio_t *rp, char *headers, URL_INFO *url_infop); |
| 19 | +static void check_important_headers(char *header, int *important_headers_flag); |
| 20 | + |
| 21 | +/* Error handling function prototypes */ |
| 22 | +static void clienterror(int fd, char *cause, char *errnum, |
| 23 | + char *shortmsg, char *longmsg); |
| 24 | + |
8 | 25 |
|
| 26 | + |
9 | 27 | /*
|
10 | 28 | * thread - Represent the routine of worker threads. It waits until it's able to
|
11 | 29 | * remove a connected descriptor from the buffer and then calls serve_client
|
|
0 commit comments