applying fix for:
authorpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Wed, 20 Jul 2005 18:42:52 +0000 (18:42 +0000)
committerpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Wed, 20 Jul 2005 18:42:52 +0000 (18:42 +0000)
    0000185: httpd infinite loop when piping to CGI script

git-svn-id: svn://busybox.net/trunk/busybox@10877 69ca8d6d-28ef-0310-b511-8ec308f3f277

networking/httpd.c

index 94fcfc8..e3f4027 100644 (file)
@@ -1259,6 +1259,8 @@ static int sendCgi(const char *url,
                        post_readed_idx += count;
                        if(post_readed_size == 0)
                                post_readed_idx = 0;
+               } else {
+                       post_readed_size = post_readed_idx = bodyLen = 0; /* broken pipe to CGI */
                }
       } else if(bodyLen > 0 && post_readed_size == 0 && FD_ISSET(a_c_r, &readSet)) {
                count = bodyLen > sizeof(wbuf) ? sizeof(wbuf) : bodyLen;
@@ -1266,7 +1268,7 @@ static int sendCgi(const char *url,
                if(count > 0) {
                        post_readed_size += count;
                        bodyLen -= count;
-      } else {
+               } else {
                        bodyLen = 0;    /* closed */
                }
       }