Priority: P1: Critical
Affects Version/s: 5.15.0
Fix Version/s: 5.15.1
Environment:Qt for Webassembly 5.15.0, emscripten 1.39.11 on Windows 10
Commits:ce8c33e710a9003a1912ab09fc31417b50b7a4b5 (qt/qtbase/dev) 36c80ec4076fcbc44c8c27de5c3b11398be39152 (qt/qtbase/5.15)
QNetworkAccessManager HTTP POST requests are not working as intended in webassembly.
The form data appears to be missing, and is replaced with the POST URL in Unicode format. However the length is set to the length of the argument in the ->post() call.
The form data sent in the example provided is:
And the reply from a simple echo service on the host with the raw data in hex and as a string is:
The post length is correct. Converting the unicode hex returned as text is:
So the form data is actually the post URL. Note if the length of the form data is longer than the post URL (the numerical padding test), it appears to overrun the string.
A second issue - this example only runs if you do not set the content type header. On Windows, this results in a debug warning, but the default works fine:
content-type missing in HTTP POST, defaulting to application/x-www-form-urlencoded. Use QNetworkRequest::setHeader() to fix this problem.
However, actually attempting to set the header on the request crashes in Webassembly with the following error:
Application exit (RuntimeError: memory access out of bounds) [Chrome]
Application exit (RuntimeError: Memory index is out of range) [Edge]
The following minimal example works as expected on Windows and MacOS.
PHP echo server: