I am looking for some help getting the HTTP status codes from messages I receive from my HTTP server.
auto status = rep->attribute(QNetworkRequest::HttpStatusCodeAttribute);
By using the line above, I am properly receiving replies such as 200 or 204 from the HTTP server when it is compiled as a desktop application. However, when I run it under WebAssembly, the status is always 0 (independent of the actual reply).
According to the description for HttpStatusCodeAttribute (QNetworkRequest class): "If the connection was not HTTP-based, this attribute will not be present". It looks to me that under WebAssembly this is not treated as an HTTP response.
I can see proper communication in WireShark, but the result of status
variable is incorrect.
Any recommendations?
I am looking for some help getting the HTTP status codes from messages I receive from my HTTP server.
auto status = rep->attribute(QNetworkRequest::HttpStatusCodeAttribute);
By using the line above, I am properly receiving replies such as 200 or 204 from the HTTP server when it is compiled as a desktop application. However, when I run it under WebAssembly, the status is always 0 (independent of the actual reply).
According to the description for HttpStatusCodeAttribute (QNetworkRequest class): "If the connection was not HTTP-based, this attribute will not be present". It looks to me that under WebAssembly this is not treated as an HTTP response.
I can see proper communication in WireShark, but the result of status
variable is incorrect.
Any recommendations?
Share Improve this question asked Jan 29 at 12:14 leonleon 13 bronze badges 3- Network management becomes a bit awkward within WebAssembly, since it's "proxied" within the context. Can you provide a more comprehensive minimal reproducible example? – musicamante Commented Feb 1 at 2:48
- @musicamante I provided an answer below. Your point is probably valid and I will post a new question with a some example. – leon Commented Feb 1 at 13:27
- @musicamante I created a new post regarding my issue with the reproducible example: stackoverflow/questions/79405700/…. It would be great if you could look into it and perhaps help me with it. – leon Commented Feb 2 at 13:39
1 Answer
Reset to default 0After some investigation, I don't believe the issue is related to the attribute method. The entire received reply is empty. There are no headers or body received by the application. The Wireshark capture shows that the entire message is properly sent out by my HTTP server and received by the browser, however, the application does not receive it.
I checked if any error was reported by the reply and received an error QNetworkReply::ProtocolFailure (399). I believe the browser strips that information and does not propagate it further to the application. I tested this in Firefox and Chrome with the same results.
As I mentioned in my original post, the communication works perfectly when compiled as a desktop application. The issue was only observed when compiled by WebAssembly.
I will close this post and reopen a new one with a new question.