diff options
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkconnectionchannel.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 0ac14c78f6..5726925cb0 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -251,6 +251,20 @@ bool QHttpNetworkConnectionChannel::sendRequest() return protocolHandler->sendRequest(); } +/* + * Invoke "protocolHandler->sendRequest" using a queued connection. + * It's used to return to the event loop before invoking sendRequest when + * there's a very real chance that the request could have been aborted + * (i.e. after having emitted 'encrypted'). + */ +void QHttpNetworkConnectionChannel::sendRequestDelayed() +{ + QMetaObject::invokeMethod(this, [this] { + Q_ASSERT(!protocolHandler.isNull()); + if (reply) + protocolHandler->sendRequest(); + }, Qt::ConnectionType::QueuedConnection); +} void QHttpNetworkConnectionChannel::_q_receiveReply() { @@ -1234,7 +1248,7 @@ void QHttpNetworkConnectionChannel::_q_encrypted() emit reply->encrypted(); } if (reply) - sendRequest(); + sendRequestDelayed(); } } |