packport fix from PHP5: read post data if they wreen't read
authorStanislav Malyshev <stas@php.net>
Mon, 21 Feb 2005 12:29:02 +0000 (12:29 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 21 Feb 2005 12:29:02 +0000 (12:29 +0000)
# this is needed for FCGI correct functioning

main/SAPI.c

index b80435e16060107cd96867a4c421688bb2572d60..2ac652cf0830c55e43657d6254ea26e396b752d8 100644 (file)
@@ -388,6 +388,16 @@ SAPI_API void sapi_deactivate(TSRMLS_D)
        zend_llist_destroy(&SG(sapi_headers).headers);
        if (SG(request_info).post_data) {
                efree(SG(request_info).post_data);
+       } else if (SG(server_context)) {
+               if(sapi_module.read_post) { 
+                       /* make sure we've consumed all request input data */
+                       char dummy[SAPI_POST_BLOCK_SIZE];
+                       int read_bytes;
+
+                       while((read_bytes = sapi_module.read_post(dummy, sizeof(dummy)-1 TSRMLS_CC)) > 0) {
+                               SG(read_post_bytes) += read_bytes;
+                       }
+               }
        }
        if (SG(request_info).raw_post_data) {
                efree(SG(request_info).raw_post_data);