# Empty request body using Embedded Perl

**URL:** <https://www.ruby-forum.com/t/empty-request-body-using-embedded-perl/201638>\
**Category:** NGINX\
**Created:** [January 12, 2011, 4:28am UTC](https://www.ruby-forum.com/t/empty-request-body-using-embedded-perl/201638 "2011-01-12T04:28:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 12, 2011, 4:28am UTC](https://www.ruby-forum.com/t/empty-request-body-using-embedded-perl/201638/1 "2011-01-12T04:28:20Z")

</div>

Hi all,

We use $r-\>request\_body method from Embedded Perl to process request  
body. The problem is although $r-\>has\_request\_body() returns 1, the  
request body is still evaluated to empty string.

PS: According to the Nginx wiki, when the client body exceeds the  
value of client\_max\_body\_size, it will be buffered to file. So we’ve  
already raised client\_max\_body\_size to 30M, but the request body  
remains an empty string.

---

<div class="post-metadata">

**Author:** ![SSSSSSS\_SS\_SSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/91b2a8/32.png) [@SSSSSSS\_SS\_SSS](https://www.ruby-forum.com/u/SSSSSSS_SS_SSS)\
**Post date:** [January 17, 2011, 4:17am UTC](https://www.ruby-forum.com/t/empty-request-body-using-embedded-perl/201638/2 "2011-01-17T04:17:29Z")

</div>

On Wed, Jan 12, 2011 at 11:26 AM, 杨镭 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi all,
> 
> We use $r-\>request\_body method from Embedded Perl to process request  
> body. The problem is although $r-\>has\_request\_body() returns 1, the  
> request body is still evaluated to empty string.

The has\_request\_body function only return memory-buffered request body  
🙂

> PS: According to the Nginx wiki, when the client body exceeds the  
> value of client\_max\_body\_size, it will be buffered to file. So we’ve  
> already raised client\_max\_body\_size to 30M, but the request body  
> remains an empty string.

No, exceeding client\_max\_body\_size gives you 413 (Request Entity Too  
Large).  
You need to raise the value of client\_body\_buffer\_size.

Cheers,  
-agentzh

---

<div class="post-metadata">

**Author:** ![SSSSSSS\_SS\_SSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/91b2a8/32.png) [@SSSSSSS\_SS\_SSS](https://www.ruby-forum.com/u/SSSSSSS_SS_SSS)\
**Post date:** [January 17, 2011, 3:44pm UTC](https://www.ruby-forum.com/t/empty-request-body-using-embedded-perl/201638/3 "2011-01-17T15:44:00Z")

</div>

Hi:

Thanks for the clarification.

I am sure that the request body did not exceed client\_body\_buffer\_size  
since those requests body are very small , e.g,. curl -X POST -d  
“name=rachel” [http://example.sdo.com](http://example.sdo.com).

If $r-\>has\_request\_body() returns 1, the request body is indeed in  
memory-buffered which means I don’t need to call  
$r-\>request\_body\_file.

Please point out what I did wrong, thanks.
