The 1.0 model is very easy right now. That is, the request from the client is simply processed and forwarded to the server. Check the local cache before forwarding. Suppose there is. Directly to the customer's local resources
The program flow is generally for example with:
Caching is done by saving the file to disk and then recording the index in memory, such as the following, perhaps considering adding other fields. such as timestamps.
typedef struct CACHE_NODE {char Name[max_line_size];char path[max_line_size];struct cache_node * NEXT;} cache_node;typedef struct Cache {int init_size;int current_size; Cache_node fileset[max_cache_size];} Cache;
and the forwarding section. is by parsing and re-filling the URL field in the request header, and then forwarding the requested implementation.
At this stage only the GET request can be processed.
The following are simple to use:
First configure the browser, take Firefox as an example (this program executes in the local 11111port)
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvc2ltb25feglhx3vlc3rj/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/southeast ">
Login directly to access the Welcome screen:
Test, with Sogou homepage for example:
It was a rather hasty act. Just to achieve the main function, there is a lot to improve the place, first mark here.
The problems that now exist:
1, the Web page is large or the element type is too long. There are certain bugs
2, some cache file storage has an exception.
Perhaps the version number to improve the place:
1, the cache file storage form and search efficiency and so on to improve. Even the form of a cache.
2, to improve the efficiency of the agent, for example, each time the request to find the IP is a very time-consuming process.
The specific code of the program is: Https://github.com/simon-xia/mini_proxy
What suggestions do you have for passing friends?
A simple, HTTP proxy with caching