Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.5.0 Alpha
-
None
-
Windows 7
Description
The XMLHttpRequest.status does not return 200 ‘OK’ HTTP status code for a successful request that is done. The issue can be reproduced with Qt’s XMLHttpRequest example (http://doc.qt.io/qt-5/qtqml-xmlhttprequest-example.html) with minor modifications. If you add check for the status in get.qml, you will always get ‘0’ even for a successful request. The code below shows the added lines:
} else if (doc.readyState == XMLHttpRequest.DONE) { if (doc.status == 200) { // check the status, 200 = OK var a = doc.responseXML.documentElement; for (var ii = 0; ii < a.childNodes.length; ++ii) { showRequestInfo(a.childNodes[ii].nodeName); } showRequestInfo("Headers -->"); showRequestInfo(doc.getAllResponseHeaders ()); showRequestInfo("Last modified -->"); showRequestInfo(doc.getResponseHeader ("Last-Modified")); } else { // status NOK showRequestInfo("ERROR, status: " + doc.status); } }
Attached also modified version of the example to show the issue.
Attachments
For Gerrit Dashboard: QTBUG-45581 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
111022,3 | qnetworkreplyfileimpl: set attributes if file was sent | dev | qt/qtbase | Status: MERGED | +2 | 0 |
111024,5 | QMLEngine: Update XHR tests with checking status code | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |