Thread: Shall I send GET to appropriate client and POST to appropriate web server in proxy?

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    16

    Shall I send GET to appropriate client and POST to appropriate web server in proxy?

    I want to write a http proxy server in C in Visual Studio. I don't want it to be in C++. Should I read rfc1945 amd rfc2616? Can you describe very simply what should I do? I didn't read those protocols yet (http 1.0 and http 1.1). Should I transfer GET to the appropriate client and POST to appropriate web server? Is there any high-level library or API can ease programming? What is the best way to implement? Using threads or io-multiplexing or asynchronous (nonblocking)?

    Thanks!

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    it's kind of dumb to ask for help like this when you haven't read the RFC's. should you read them? of course. do that first, then ask questions. for api help, do this 'google c library http'. as for how to implement there are tradeoffs for each approach. threads make it easy to program but aren't as scalable as using asynchronous methods.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    16
    Quote Originally Posted by dmh2000 View Post
    it's kind of dumb to ask for help like this when you haven't read the RFC's. should you read them? of course. do that first, then ask questions. for api help, do this 'google c library http'. as for how to implement there are tradeoffs for each approach. threads make it easy to program but aren't as scalable as using asynchronous methods.
    Are you sure? Because writing asynchronous doesn't use multi-CPUs, at least, if OS is multi-threaded written, the process should process packets in one thread (other than the programmer mix the solutions). Is it right?
    Last edited by nabat1; 01-14-2013 at 12:14 PM.

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    Quote Originally Posted by nabat1 View Post
    I want to write a http proxy server in C in Visual Studio. I don't want it to be in C++. Should I read rfc1945 amd rfc2616? Can you describe very simply what should I do?
    Use a third-party library to help you if you can. Reading the RFCs may help, but why implement it from scratch?

    For GET and POST see Libcurl: cURL and libcurl
    Libcurl is easy to call from C and other languages.

    For the HTTP Proxy server part, see here: c - HTTP proxy server - Stack Overflow

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    Quote Originally Posted by nabat1 View Post
    Are you sure? Because writing asynchronous doesn't use multi-CPUs, at least, if OS is multi-threaded written, the process should process packets in one thread (other than the programmer mix the solutions). Is it right?
    read this. its a little old but it summarizes the issue. The C10K problem

    yes threading will use more cores, but the efficiency of that drops off if you have more threads than cores.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 02-24-2012, 07:22 PM
  2. Replies: 0
    Last Post: 12-03-2011, 05:41 AM
  3. Connection between proxy server and the server
    By vbx_wx in forum Networking/Device Communication
    Replies: 2
    Last Post: 02-07-2011, 01:51 PM
  4. How to Send Mac Address From Client to Server
    By Lieyza197 in forum C Programming
    Replies: 2
    Last Post: 05-27-2009, 09:58 AM
  5. Client/server problem; server either stops receiving data or client stops sending
    By robot-ic in forum Networking/Device Communication
    Replies: 10
    Last Post: 02-16-2009, 11:45 AM

Tags for this Thread