You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -37,22 +37,22 @@ A web proxy is a program that acts as a middleman between a Web browser and an e
37
37
It has the following detailed behavior:
38
38
-**Set up** the proxy to accept incoming connections:
39
39
40
-
1. Proxy creates a listening descriptor that is ready to receive connection requests on port ***`port`*** by calling ***`Open_listenfd()`*** funciton defined in **`socket.c`** file.
40
+
1. Proxy creates a listening descriptor that is ready to receive connection requests on port _port_ by calling ***`Open_listenfd()`*** funciton.
41
41
42
42
-**Set up** the proxy to deal with multiple concurrent connections using **prethreading** technique:
43
43
44
-
1. After initializing buffer ***`sbuf`*** declared in **`sbuf.h`** file, the main thread creates the set of worker threads by calling ***`Pthread_create()`*** defined in **`thread.c`** file.
45
-
2. Main thread then enters an infinite loop, waiting for connection requests using ***`Accept()`*** function defined in **`socket.c`** file.
46
-
3. It then inserts the resulting connected descriptors in ***`sbuf`***.
44
+
1. After initializing buffer _sbuf_, the main thread creates the set of worker threads by calling ***`Pthread_create()`***.
45
+
2. Main thread then enters an infinite loop, waiting for connection requests using ***`Accept()`*** function.
46
+
3. It then inserts the resulting connected descriptors in _sbuf_.
47
47
4. Each worker thread waits until it is able to remove a connected descriptor from the buffer and then calls the ***`serve_client()`*** function to serve the client.
48
48
49
49
-**Run*****`serve_client()`*** routine:
50
50
51
-
1. Read and parse the _HTTP_ request sent from the client by calling ***`read_HTTP_request()`*** function defined in **`serve.c`** file.
52
-
2. using ***`hash()`*** function defined in **`cache.c`** file, generate ***`HTTP_request_hash`*** that will be used to check if the cache contains the requested web object.
53
-
3. If the object is cached then read the object out of the cache rather than communicating again with the server by calling ***`service_from_cache()`*** function defined in **`service.c`** file.
54
-
4. Otherwise, using ***`service_from_server()`*** function, Try to connect the server then send it the ***`parsed_request`***, read its response, write it back to the client, and save it in an internal buffer for possible caching.
55
-
5. If ***`object_size`*** is less than ***`MAX_OBJECT_SIZE`*** write the object in a suitable cahce line.
51
+
1. Read and parse the _HTTP_ request sent from the client by calling ***`read_HTTP_request()`*** function.
52
+
2. using ***`hash()`*** function, generate _HTTP_request_hash_ that will be used to check if the cache contains the requested web object.
53
+
3. If the object is cached then read the object out of the cache rather than communicating again with the server by calling ***`service_from_cache()`*** function.
54
+
4. Otherwise, using ***`service_from_server()`*** function, Try to connect the server then send it the _parsed_request_, read its response, write it back to the client, and save it in an internal buffer for possible caching.
55
+
5. If _object_size_ is less than _MAX_OBJECT_SIZE_ write the object in a suitable cahce line.
0 commit comments