MFB: fix http_get_request_body[_stream]() with FastCGI SAPI
authorMichael Wallner <mike@php.net>
Fri, 31 Jul 2009 08:25:52 +0000 (08:25 +0000)
committerMichael Wallner <mike@php.net>
Fri, 31 Jul 2009 08:25:52 +0000 (08:25 +0000)
http_api.c

index 4fa8c3d5b703203f92b84c083e421500bc7f8a9b..04247fa310d771ac16a9fc99e810671ff1f7db56 100644 (file)
@@ -357,6 +357,9 @@ PHP_HTTP_API STATUS _http_get_request_body_ex(char **body, size_t *length, zend_
                        memcpy(*body + *length, buf, len);
                        *length += len;
                        (*body)[*length] = '\0';
+                       if (len < (int) sizeof(buf)) {
+                               break;
+                       }
                }
                
                /* check for error */
@@ -395,6 +398,9 @@ PHP_HTTP_API php_stream *_http_get_request_body_stream(TSRMLS_D)
                        
                        while (0 < (len = sapi_module.read_post(buf, sizeof(buf) TSRMLS_CC))) {
                                php_stream_write(s, buf, len);
+                               if (len < (int) sizeof(buf)) {
+                                       break;
+                               }
                        }
                        
                        if (len < 0) {