Skip to content

Commit f3cbd8f

Browse files
committed
Update service
1 parent afb7daa commit f3cbd8f

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

service.c

+18
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,25 @@
55

66
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";
77

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+
825

26+
927
/*
1028
* thread - Represent the routine of worker threads. It waits until it's able to
1129
* remove a connected descriptor from the buffer and then calls serve_client

service.h

-17
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,4 @@
1313

1414
/* Worker thread routine prototype */
1515
void *thread(void *vargp);
16-
17-
/* Proxy/client and proxy/server functions prototypes */
18-
static void serve_client(int connfd, cache_line_t *cache);
19-
static void service_from_cache(int connfd, cache_line_t *cache, size_t matched_line_idx);
20-
static void service_from_server(int connfd, URL_INFO url_info, char *parsed_request,
21-
cache_line_t *cache, size_t HTTP_request_hash);
22-
static int connect_server(URL_INFO url_info, char *parsed_request, int connfd, char *cache_buf);
23-
24-
/* Manipulating HTTP requests functions prototypes */
25-
static int read_HTTP_request(int connfd, URL_INFO *url_infop, char *headers);
26-
static int read_request_line(rio_t *rp, URL_INFO *url_infop, char *parsed_request);
27-
static void read_request_headers(rio_t *rp, char *headers, URL_INFO *url_infop);
28-
static void check_important_headers(char *header, int *important_headers_flag);
29-
30-
/* Error handling function prototypes */
31-
static void clienterror(int fd, char *cause, char *errnum,
32-
char *shortmsg, char *longmsg);
3316
#endif

0 commit comments

Comments
 (0)