This command-line tool implements a web proxy server with support for caching. It is designed to handle HTTP requests and optionally apply different cache replacement policies for improved performance.
-
To compile the program, run:
make all
-
To clean up object files, run:
make clean
To launch the proxy server:
./proxy <port> [cache replacement policy]-
Run the proxy on port 8080 with the default cache replacement policy (LRU):
./proxy 8080
-
Run the proxy with the LRU (Least Recently Used) cache policy:
./proxy 8080 LRU
-
Run the proxy with the LFU (Least Frequently Used) cache policy:
./proxy 8080 LFU
This tool is compatible with macOS and Linux platforms.
Firefox is recommended due to its easy and precise proxy configuration:
- Open Settings and search for "Proxy".
- Choose Manual proxy configuration.
- Set the HTTP proxy to
localhost(127.0.0.1) and specify the port used by your proxy. - Navigate to
about:configand set the following:network.proxy.allow_hijacking_localhost→truebrowser.cache.disk.enable→falsebrowser.cache.memory.enable→false
⚠️ Don’t forget to restore your cache settings after testing.
Browsers like Chrome and Safari require system-wide proxy settings, which can be less convenient for testing. If possible, use Firefox for a more streamlined experience with fine-grained control over HTTP requests.
./driver.sh