Bug 63366

Summary: POST body is empty when REQUEST is send with transfer-encoding:chunked
Product: Apache httpd-2 Reporter: Max Cuttins <massimiliano.cuttini>
Component: mod_proxy_fcgiAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: blocker    
Priority: P2    
Version: 2.4.39   
Target Milestone: ---   
Hardware: All   
OS: Linux   

Description Max Cuttins 2019-04-19 15:00:28 UTC
The POST raw data is completly empty when the POST is sent with "transfer-encoding: chunked". Read POST raw data as a stream should be the right way to handle this kind of transfer enconding, however it's completly useless.


$fp = fopen('php://input', 'rb');
stream_filter_append($fp, 'dechunk', STREAM_FILTER_READ);
$POST = stream_get_contents($fp);


$POST is always empty if the request received has "transfer-econding:chuncked".

Same issue could be seen into all kind of handler:


This bug seems the consequences of this one:

However this is a more specific error and relates to more big issue.
Infact, by definition, with "transfer chuncked" there is no CONTENT-LENGTH at all and it's right that this it's not present. So, I would say that missing the CONTENT-LENGTH is right due to the design of the transfer chunked encoding.

Here the issue is not about the CONTENT-LENGTH but instead the issue is that the stream is not available in the php://input and is not readable causing dataloss on the POST value.
Comment 1 kisscool82 2020-04-28 13:45:26 UTC
I'm encountering the same bug. Please help us :(
Comment 2 kisscool82 2020-04-28 13:46:27 UTC
I'm encountering the same bug. Please help us :(