H2C - make sure we send the client preface and settings
It's required as a response to upgraded protocol and apparently some servers would wait for it, not sending any frames. Becomes a problem in case only one request was sent. Fixes: QTBUG-83312 Change-Id: I90dc5c04095f0b78baa404466625d329dc4c6e21 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
2d0c7d3d9e
commit
603eaa9fbb
@ -220,6 +220,12 @@ void QHttp2ProtocolHandler::handleConnectionClosure()
|
|||||||
goingAway = true;
|
goingAway = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QHttp2ProtocolHandler::ensureClientPrefaceSent()
|
||||||
|
{
|
||||||
|
if (!prefaceSent)
|
||||||
|
sendClientPreface();
|
||||||
|
}
|
||||||
|
|
||||||
void QHttp2ProtocolHandler::_q_uploadDataReadyRead()
|
void QHttp2ProtocolHandler::_q_uploadDataReadyRead()
|
||||||
{
|
{
|
||||||
if (!sender()) // QueuedConnection, firing after sender (byte device) was deleted.
|
if (!sender()) // QueuedConnection, firing after sender (byte device) was deleted.
|
||||||
|
@ -93,6 +93,7 @@ public:
|
|||||||
QHttp2ProtocolHandler &operator = (QHttp2ProtocolHandler &&rhs) = delete;
|
QHttp2ProtocolHandler &operator = (QHttp2ProtocolHandler &&rhs) = delete;
|
||||||
|
|
||||||
Q_INVOKABLE void handleConnectionClosure();
|
Q_INVOKABLE void handleConnectionClosure();
|
||||||
|
Q_INVOKABLE void ensureClientPrefaceSent();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void _q_uploadDataReadyRead();
|
void _q_uploadDataReadyRead();
|
||||||
|
@ -488,6 +488,9 @@ void QHttpNetworkConnectionChannel::allDone()
|
|||||||
QHttp2ProtocolHandler *h2c = static_cast<QHttp2ProtocolHandler *>(protocolHandler.data());
|
QHttp2ProtocolHandler *h2c = static_cast<QHttp2ProtocolHandler *>(protocolHandler.data());
|
||||||
QMetaObject::invokeMethod(h2c, "_q_receiveReply", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(h2c, "_q_receiveReply", Qt::QueuedConnection);
|
||||||
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
|
||||||
|
// If we only had one request sent with H2 allowed, we may fail to send
|
||||||
|
// a client preface and SETTINGS, which is required by RFC 7540, 3.2.
|
||||||
|
QMetaObject::invokeMethod(h2c, "ensureClientPrefaceSent", Qt::QueuedConnection);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Ok, whatever happened, we do not try HTTP/2 anymore ...
|
// Ok, whatever happened, we do not try HTTP/2 anymore ...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user