views:

884

answers:

3

I must develop proxy server that work with only HTTP 1.0 in Linux and by c . I need some hint to start developing .

+4  A: 

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.

monksy
+11  A: 
  • 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
jitter
+1 for being tolerant and at least trying to provide a helpful answer.
Tim Post
"Send response to client" how to ? with table ? which information must be saved ?
SjB
+2  A: 

How to create a proxy server:

  1. Download Squid Cache.
  2. Modify as required.
brianegge