-
Notifications
You must be signed in to change notification settings - Fork 0
gtungatkar/HTTP-Proxy-cache
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
*****Simple HTTP Web Proxy cache***** ************************************* Author: Gaurav Tungatkar Description: A HTTP proxy. Point your browser to the proxy. It fetches the pages from the actual server and caches them. It follows the HTTP RFC regarding keeping the cache updated. If the http response contains if-modified-since field, a conditional get is sent to determine the liveness of the cached object. If it does not contain if-modified-since, simple fiexd timeout strategy is used. Handy doubly linked list utility created, reusable in other projects. Code organization and directory structure: Project3 |__ src - All .c source files in this directory |__ include - All header files in this directory |_Makefile, config.txt - These files at the same level tokenize.c -utility function to separate a line into tokens fileparser.c -utility function to parse a file line by line http_config.c -Handles reading of config file, error checking and populating in-memory config object. http_cache.c -Main http web cache engine, acts as client as well as server listener.c -Connection handler routine Instructions to compile: 1. Go to base project folder Project3. 2. make Instructions to run: 1. From Project3 folder ./obj/http_server [config_file] Config file path is optional. It may be specified at the command line. If not provided, following assumptions hold:- a. config.txt located in Project1 directory is the default config file b. The config.txt file must be located in the cwd(current working directory from which server is run) Cache Replacement: Modified FIFO - The cache follows a modified First-In-first-out policy. Lets say cache is full. New entry has size s. The first entry in FIFO order which is of size greater than s, is removed. Hence, now the cache will have sufficent space to add new entry. Cache Design - Cache - A doubly linked list which stores all cache entries. Hashtable - An array of list pointers, indexed by the hash index, pointing to all elements hashing to that value. So any element can be looked up directly based on its hash value of its http header. Cache entry - Each entry stores a list of fragments - data buffers linked together which form part of the object. Cache stale entries - Cache objects are updated lazily. No timer is used. Only when a particular entry is accessed, it is checked for staleness. If stale, a request to original server is sent and new data is cached. Limitations: Client may send requests in HTTP/1.0 or HTTP/1.1 version. However, server response is always HTTP/1.0 This folows the Robustness principle given in rfc 2145 http://www.ietf.org/rfc/rfc2145.txt Logging: Logs can be turned off by defining TRACE to be 0 in log.h at compile time. All logs are currently directed to stdout.
About
A HTTP proxy that acts as a web cache.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published