I must develop proxy server that work with only HTTP 1.0 in Linux and by c . I need some hint to start developing .
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
- I assume you are confident in using linux and the language c (no hints for that, else don't start with developing a proxy)
- Read and understand the RFC 1945 HTTP/1.0 (pay attention to the specific mentioning of proxy)
- Determine what kind of proxy you want (web/caching/content-filter/anonymizer/transparent/non-transparent/reverse/gateway/tunnel/...)
- Start developing the server
Basic steps
- Open port
- Listen on port
- Get all request sent from the client to that port (maybe make the whole thing multithreaded to be able to handle more than 1 request at a time)
- Determine if it is a valid HTTP 1.0 request
- Extract the request components
- Rebuild the request according to what type of proxy you are
- Send the new request
- Get the response
- Send response to client
回答2:
How to create a proxy server:
- Open a port to listen on
- Catch all incoming requests on that report
- Determine the web address requested
- Open a connection to the host and forward the request
- Receive response
- Send the response back to the requesting client
Additionally: Use threads to allow for multiple requests to the server.