laminas / laminas-http

Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests
https://docs.laminas.dev/laminas-http/
BSD 3-Clause "New" or "Revised" License
36 stars 27 forks source link

Fix Content-Length for POST when data empty #78

Open rouja opened 1 year ago

rouja commented 1 year ago
Q A
Documentation no
Bugfix yes
BC Break no
New Feature no
RFC yes
QA no

Description

The RFC7230 says :

For example, a Content-Length header field is normally sent in a POST request even when the value is 0 (indicating an empty payload body).

Some load balancers reject empty POST without a Content-Lenght set to 0 with an HTTP 411 error. For instance Google Global Load Balancers does.