-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.9.1
-
None
-
bb40f641f (dev), e134d01fc (6.10), 02af14ec1 (6.9), f82703d29 (tqtc/lts-6.8)
When using QNetworkAccessManager::sendCustomRequest(...) with an http GET request, and a non-nullptr QIODevice, then a "Content-Length: 0" header is sent, even if the data from the device is empty.
Per RFC9110, "A user agent SHOULD NOT send a Content-Length header field when the request message does not contain content and the method semantics do not anticipate such data." Semantically, HTTP_GET and HTTP_HEAD shouldn't send the header when the data is empty.
My suggestion is that the Content-Length header not be sent for GET, HEAD, DELETE, and CONNECT requests when the data body is empty EVEN if a non-null data device is passed to the call. Some CDNs and other common servers may respond differently for GET calls with "Content-Length: 0" header.
Issue encountered when using KIO::get(...) from the KDE Frameworks, in https://bugs.kde.org/show_bug.cgi?id=507523
For Gerrit Dashboard: QTBUG-138848 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
666392,11 | HTTP: don't send content-length: 0 | dev | qt/qtbase | Status: MERGED | +2 | 0 |
672494,2 | HTTP: don't send content-length: 0 | 6.10 | qt/qtbase | Status: MERGED | +2 | 0 |
676032,2 | HTTP: don't send content-length: 0 | 6.9 | qt/qtbase | Status: MERGED | +2 | 0 |
676088,2 | HTTP: don't send content-length: 0 | tqtc/lts-6.8 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |