fix http_get_request_body[_stream]() with FastCGI SAPI
authorMichael Wallner <mike@php.net>
Thu, 30 Jul 2009 08:08:37 +0000 (08:08 +0000)
committerMichael Wallner <mike@php.net>
Thu, 30 Jul 2009 08:08:37 +0000 (08:08 +0000)
http_api.c
package2.xml

index 4fa8c3d5b703203f92b84c083e421500bc7f8a9b..06ac89a176d271e16ac74e11cf8b6eadec9a0661 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 < 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 < sizeof(buf)) {
+                                       break;
+                               }
                        }
                        
                        if (len < 0) {
index fa3c60068284c14f5437e2a16b2909f281eafa5c..f11b5d2b0d9a28055556ec4402ba3cb066c5220b 100644 (file)
@@ -40,6 +40,7 @@ support. Parallel requests are available for PHP 5 and greater.
  <license>BSD, revised</license>
  <notes><![CDATA[
 * Fixed PHP5.1 build
+* Fixed http_get_request_body[_stream]() with FastCGI SAPI
 ]]></notes>
  <contents>
   <dir name="/">