开发者

How to write a http1.0 proxy server in c in linux?

开发者 https://www.devze.com 2022-12-11 17:17 出处:网络
I must develop proxy server that work with o开发者_StackOverflow社区nly HTTP 1.0 in Linux and by c .

I must develop proxy server that work with o开发者_StackOverflow社区nly HTTP 1.0 in Linux and by c . I need some hint to start developing .


  • 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

  1. Open port
  2. Listen on port
  3. 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)
  4. Determine if it is a valid HTTP 1.0 request
  5. Extract the request components
  6. Rebuild the request according to what type of proxy you are
  7. Send the new request
  8. Get the response
  9. Send response to client


How to create a proxy server:

  1. Open a port to listen on
  2. Catch all incoming requests on that report
  3. Determine the web address requested
  4. Open a connection to the host and forward the request
  5. Receive response
  6. Send the response back to the requesting client

Additionally: Use threads to allow for multiple requests to the server.

0

精彩评论

暂无评论...
验证码 换一张
取 消