summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpprotocolhandler.cpp
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2022-02-03 15:08:08 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2022-02-18 13:44:41 +0100
commit9078b41dde7eddd449d77399dbd0102f656cafab (patch)
tree681e4366e82d5dab3c7041462fe9c00710211a74 /src/network/access/qhttpprotocolhandler.cpp
parent2088e8ae21e1b278d9ea11781fb5403ff5a6b671 (diff)
QHttp: Move the emission of requestSent
Moved to after the header is actually written, not just generated. For requests with data (put/post) we may have to wait for a callback before the data to write is available. Since we then delay writing the header as well it would be disingenuous to emit requestSent(). Pick-to: 6.3 Change-Id: I76c2d40ca48faaa1f6730ce8b3d5a8a4c3156f8f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access/qhttpprotocolhandler.cpp')
-rw-r--r--src/network/access/qhttpprotocolhandler.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp
index 488c226459..973c200736 100644
--- a/src/network/access/qhttpprotocolhandler.cpp
+++ b/src/network/access/qhttpprotocolhandler.cpp
@@ -319,7 +319,6 @@ bool QHttpProtocolHandler::sendRequest()
#else
m_header = QHttpNetworkRequestPrivate::header(m_channel->request, false);
#endif
- QMetaObject::invokeMethod(m_reply, "requestSent", Qt::QueuedConnection);
// flushing is dangerous (QSslSocket calls transmit which might read or error)
// m_socket->flush();
@@ -335,6 +334,7 @@ bool QHttpProtocolHandler::sendRequest()
} else {
// no data to send: just send the HTTP headers
m_socket->write(qExchange(m_header, {}));
+ QMetaObject::invokeMethod(m_reply, "requestSent", Qt::QueuedConnection);
m_channel->state = QHttpNetworkConnectionChannel::WaitingState; // now wait for response
sendRequest(); //recurse
}
@@ -409,6 +409,7 @@ bool QHttpProtocolHandler::sendRequest()
currentWriteSize = m_socket->write(qExchange(m_header, {}));
if (currentWriteSize != -1)
currentWriteSize -= headerSize;
+ QMetaObject::invokeMethod(m_reply, "requestSent", Qt::QueuedConnection);
}
if (currentWriteSize == -1 || currentWriteSize != currentReadSize) {
// socket broke down