title: HTTP Proxy server is not able to collect entire response from host server in C
body: <p>I am implementing an HTTP proxy-server in C.<br/><br/>I am getting the HTTP request header from the brownser(client) and parsing it to find url,portnumber and so on. Then I am making a request to the remote server in the following format:<br/><br/>  <strong>GET / HTTP1.0\r\nHost: www.gmail.com:80\r\n\r\n</strong><br/><br/>But during execution, the proxy server is not able to read entire date from the remote server.<br/> <br/>Is it problem with header from proxy server to remote server or reading data from server. </p>
  
  <pre><code> void handle_connection(......)
  {
      ......
     //request send from proxy to remote server
        sprintf(buffer, "%s %s HTTP/1.%d\r\nHost: %s:80\r\n\r\n"
       , http_args[0], requested_url-&gt;file, requested_url-&gt;proto, requested_url-&gt;host);
            //sending the request to remote server connection socket rfd
      n = write(rfd, buffer, sizeof(buffer));
            //reading data from the response of the server
      while ((n = read(rfd, buffer, BUFFSIZE)) &gt; 0) {
          write(connfd, buffer, BUFFSIZE); //sending it to client web brownser
          bzero(buffer, BUFFSIZE);
      }
      close(rfd);
  }
  </code></pre>