After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 634513 - XMLHttpRequest with empty POST body has no content-length
XMLHttpRequest with empty POST body has no content-length
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Backend
2.30.x
Other Linux
: Normal normal
: ---
Assigned To: Xan Lopez
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-11-10 13:31 UTC by Benjamin Dumke
Modified: 2012-08-14 15:58 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Benjamin Dumke 2010-11-10 13:31:12 UTC
An AJAX POST request with no body -- i.e. request.send(null) -- will not have a Content-Length header set, resulting in an invalid request that will be rejected by most servers with a 411 status code.
Comment 1 Dan Winship 2010-11-10 14:07:58 UTC
It's not "an invalid request" at the HTTP level. While POST normally has a request body, it doesn't syntactically require one.

Anyway, the fix here would be for webkitgtk to explicitly call soup_message_headers_set_content_length(msg->request_headers, 0) when it needs to explicitly indicate an empty body as opposed to no body.
Comment 2 Xan Lopez 2011-04-20 21:17:30 UTC
CCing the Sergio.
Comment 3 Xan Lopez 2012-08-14 14:54:25 UTC
Second ping to the Sergio.
Comment 4 Sergio Villar 2012-08-14 15:00:48 UTC
There is a layout tests in WebKit that checks this IIRC...

Yeah it's http/tests/xmlhttprequest/methods.html. We have a specific expected result for that test. What Dan suggests LGTM so I guess we can move this to the webkit bz.
Comment 5 Sergio Villar 2012-08-14 15:11:35 UTC
I have just checked our expected results for that test and I found this for POST:

POST(""): POST(0 bytes), Content-Type: application/xml
POST(null): POST(0 bytes), Content-Type: null
POST("123"): POST(3 bytes), Content-Type: application/xml

As this test is working fine, this means that our current code is adding a Content-Length=0 for POST messages with null body.

Benjamin do you have any example that is not working for you? Oh the bug is from 2010, maybe it got fixed in the meantime, I remember working on issues related to that test...
Comment 6 Dan Winship 2012-08-14 15:58:21 UTC
Yeah, this got fixed as https://bugs.webkit.org/show_bug.cgi?id=82036