+ *body = SG(request_info).raw_post_data;
+
+ if (dup) {
+ *body = estrndup(*body, *length);
+ }
+ return SUCCESS;
+ } else if (sapi_module.read_post && !HTTP_G(read_post_data)) {
+ char buf[4096];
+ int len;
+
+ HTTP_G(read_post_data) = 1;
+
+ while (0 < (len = sapi_module.read_post(buf, sizeof(buf) TSRMLS_CC))) {
+ *body = erealloc(*body, *length + len + 1);
+ memcpy(*body + *length, buf, len);
+ *length += len;
+ (*body)[*length] = '\0';
+ }
+
+ /* check for error */
+ if (len < 0) {
+ STR_FREE(*body);
+ *length = 0;
+ return FAILURE;
+ }
+
+ SG(request_info).raw_post_data = *body;
+ SG(request_info).raw_post_data_length = *length;
+
+ if (dup) {
+ *body = estrndup(*body, *length);
+ }