- This project implements a multi-threaded HTTP proxy server in C that supports caching using the Least Recently Used (LRU) policy. It handles multiple client requests concurrently using threads and semaphores, and stores frequently accessed responses in memory for faster access.
- Multi-threaded: Handles multiple clients concurrently using POSIX threads.
- Caching: Speeds up repeated requests with an in-memory LRU cache.
- GET Request Forwarding: Forwards HTTP GET requests to remote servers.
- Concurrency Safe: Uses semaphores and mutexes to manage access to shared resources.
- Error Handling: Returns HTTP error codes like 400, 403, 404, 500, etc.
- C (POSIX Sockets & Threads)
- TCP/IP Networking
- LRU Cache via Linked List
- Semaphores (<semaphore.h>)
- Pthread mutex for synchronization
- MultiThreaded_Proxy_Server_Client/
- ├── proxy_server_with_cache.c # Main proxy server source code
- ├── proxy_parse.h / proxy_parse.c # Request parsing utilities
- ├── Makefile # Build file
- └── README.md # Project documentation
- in bash: make
- in bash: ./proxy 8080
- Client sends an HTTP GET request to the proxy.
- Proxy checks if the response is already in cache.
- If cached → returns the stored response.
- If not cached → forwards the request to remote server, receives the response, caches it, and sends it back to the client.
- Cache uses LRU policy to evict old items when space is full.
- Only supports HTTP GET requests.
- Does not support HTTPS.
- No persistent (disk-based) caching — in-memory only.
- Harshit Jasuja
- Computer Science Engineering Student