httpd: fix bug where we were trying to read more POSTDATA than content-length
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Sun, 14 Oct 2007 02:34:20 +0000 (02:34 +0000)
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Sun, 14 Oct 2007 02:34:20 +0000 (02:34 +0000)
git-svn-id: svn://busybox.net/trunk/busybox@20254 69ca8d6d-28ef-0310-b511-8ec308f3f277

networking/httpd.c

index 6118502..82755a0 100644 (file)
@@ -1051,6 +1051,17 @@ static NOINLINE void cgi_io_loop_and_exit(int fromCgi_rd, int toCgi_wr, int post
         * and send it to the peer. So please no SIGPIPEs! */
        signal(SIGPIPE, SIG_IGN);
 
+       // We inconsistently handle a case when more POSTDATA from network
+       // is coming than we expected. We may give *some part* of that
+       // extra data to CGI.
+
+       //if (hdr_cnt > post_len) {
+       //      /* We got more POSTDATA from network than we expected */
+       //      hdr_cnt = post_len;
+       //}
+       post_len -= hdr_cnt;
+       /* post_len - number of POST bytes not yet read from network */
+
        /* NB: breaking out of this loop jumps to log_and_exit() */
        out_cnt = 0;
        while (1) {