Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83991

Qt WebAssembly sending wrong HTTP POST requests

    XMLWordPrintable

Details

    • WebAssembly
    • 3fbf7b34cc2242559a047c3868855c9de6f0c3d3 (qt/qtbase/dev) 3ef5bc06fab6473f5b2d3e430a79ec8d836c6df8 (qt/qtbase/5.15)

    Description

      Hi,

      In spite of all CORS-related concerns when making HTTP request from Qt WebAssembly applications, I'd like to report the following unexpected behavior when doing simple GET and POST requests. The attached example works fine for Desktop Qt 15.5-beta4 GCC 64bit. When running with WebAssembly Qt 15.5-beta4, the following two unexpected cases occur:

      1) When doing a GET request, the returned status code is 0 (in contrast to 200 when running with Desktop Qt). In spite of that, the response text is okay.

      2) When doing a POST request, JSON data sent to server in HTTP body is corrupted. For some unknown reason, the sent data is replaced by "/.h.o.m.e./.w.e.b._.u." (Chromium) or "/home/web_u" (Firefox) (which happens to be a directory created in <myapp>-wasm.js). In Chromium, this return a 0 status code and response text is okay (however, it's useless because of corrupted HTTP body). In Firefox, this alternates between behaving like Chromium or generating a "index out of bounds" error.

      Tests were done using https://requestbin.com/r/en85xho2bb9xt/1bSgAY4ZZmJGQMWYSNcA8XR4okX as dummy server, using XmlHttpRequest and JavaScript. Doing requests with QNetworkAccessManager presents the same results.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lpotter Lorn Potter
            sandroandrade Sandro S. Andrade
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes