From 5e0a45e932424c5ed661ae518ca21d2ab627db2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 21 Jun 2019 13:02:34 +0200 Subject: QSocks5SocketEngine: pass data to application when connected If we end up in the connected state then we should pass on any remaining data immediately instead of waiting until the next time we get a read notification. The other `case`s in the switch might be able to do something similar, but I don't want to introduce that logic now in case it breaks something else, the Connected branch is small and simple to deal with. Should severely reduce flakiness with socks proxy in CI under pressure. Task-number: QTBUG-76367 Change-Id: I0965d4c62a29a25ce6b8dd60862a464279aef0b4 Reviewed-by: Timur Pocheptsov Reviewed-by: Ryan Chu --- src/network/socket/qsocks5socketengine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/network') diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 6791b85273..d2328f8536 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1188,6 +1188,8 @@ void QSocks5SocketEnginePrivate::_q_controlSocketReadNotification() break; case RequestMethodSent: parseRequestMethodReply(); + if (socks5State == Connected && data->controlSocket->bytesAvailable()) + _q_controlSocketReadNotification(); break; case Connected: { QByteArray buf; -- cgit v1.2.3 From 1eeab2d27f61485cb53364d40339a8d832a076e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 24 Jun 2019 18:55:36 +0200 Subject: QSocks5SocketEngine: account for in-transit signal when waiting for read When calling waitFor{ReadyRead,Disconnected} it will wait for data but if the data is already received and the read notification has been queued (and there's no more data coming in) it will return false. By checking if a read notification has been queued and then handling this we can easily take care of this scenario. Fixes some flaky tests which missed the read data in waitForDisconnect and similar. Fixes: QTBUG-38385 Change-Id: Ic05d59883c1175783e56ff1822b6636c35aec874 Reviewed-by: Volker Hilsheimer --- src/network/socket/qsocks5socketengine.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/network') diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index d2328f8536..e7e4d64c32 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1753,6 +1753,11 @@ bool QSocks5SocketEngine::waitForRead(int msecs, bool *timedOut) return false; if (d->data->controlSocket->state() == QAbstractSocket::UnconnectedState) return true; + if (bytesAvailable() && d->readNotificationPending) { + // We've got some data incoming, but the queued call hasn't been performed yet. + // The data is where we expect it to be already, so just return true. + return true; + } // we're connected if (d->mode == QSocks5SocketEnginePrivate::ConnectMode || -- cgit v1.2.3 From 833519f2debf963ec198760475ba26319303d0e0 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 2 Jul 2019 13:20:03 +0200 Subject: Fix compiler warnings when building with DEBUG defines set Change-Id: I51fc7aae246916e585b21b4e7da1fc5a4ac392fd Reviewed-by: Timur Pocheptsov --- src/network/socket/qnativesocketengine_win.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/network') diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index c999bd2088..986b0b4861 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -608,13 +608,13 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() socketType = qt_socket_getType(socketDescriptor); #if defined (QNATIVESOCKETENGINE_DEBUG) - QString socketProtocolStr = "UnknownProtocol"; - if (socketProtocol == QAbstractSocket::IPv4Protocol) socketProtocolStr = "IPv4Protocol"; - else if (socketProtocol == QAbstractSocket::IPv6Protocol) socketProtocolStr = "IPv6Protocol"; + QString socketProtocolStr = QStringLiteral("UnknownProtocol"); + if (socketProtocol == QAbstractSocket::IPv4Protocol) socketProtocolStr = QStringLiteral("IPv4Protocol"); + else if (socketProtocol == QAbstractSocket::IPv6Protocol) socketProtocolStr = QStringLiteral("IPv6Protocol"); - QString socketTypeStr = "UnknownSocketType"; - if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = "TcpSocket"; - else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = "UdpSocket"; + QString socketTypeStr = QStringLiteral("UnknownSocketType"); + if (socketType == QAbstractSocket::TcpSocket) socketTypeStr = QStringLiteral("TcpSocket"); + else if (socketType == QAbstractSocket::UdpSocket) socketTypeStr = QStringLiteral("UdpSocket"); qDebug("QNativeSocketEnginePrivate::fetchConnectionParameters() localAddress == %s, localPort = %i, peerAddress == %s, peerPort = %i, socketProtocol == %s, socketType == %s", localAddress.toString().toLatin1().constData(), localPort, peerAddress.toString().toLatin1().constData(), peerPort, socketProtocolStr.toLatin1().constData(), socketTypeStr.toLatin1().constData()); #endif @@ -1487,8 +1487,8 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) } #if defined (QNATIVESOCKETENGINE_DEBUG) - qDebug("QNativeSocketEnginePrivate::nativeWrite(%p \"%s\", %li) == %li", - data, qt_prettyDebug(data, qMin((int)ret, 16), (int)ret).data(), (int)len, (int)ret); + qDebug("QNativeSocketEnginePrivate::nativeWrite(%p \"%s\", %lli) == %lli", + data, qt_prettyDebug(data, qMin(int(ret), 16), int(ret)).data(), len, ret); #endif return ret; @@ -1530,11 +1530,11 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) #if defined (QNATIVESOCKETENGINE_DEBUG) if (ret != -2) { - qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %li) == %li", - data, qt_prettyDebug(data, qMin((int)bytesRead, 16), (int)bytesRead).data(), (int)maxLength, (int)ret); + qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %lli) == %lli", + data, qt_prettyDebug(data, qMin(int(bytesRead), 16), int(bytesRead)).data(), maxLength, ret); } else { - qDebug("QNativeSocketEnginePrivate::nativeRead(%p, %li) == -2 (WOULD BLOCK)", - data, int(maxLength)); + qDebug("QNativeSocketEnginePrivate::nativeRead(%p, %lli) == -2 (WOULD BLOCK)", + data, maxLength); } #endif -- cgit v1.2.3 From 0f92f2f35d55f2de545e8472c6b240c8fd0bb53f Mon Sep 17 00:00:00 2001 From: Felix Barz Date: Sun, 30 Jun 2019 20:43:03 +0200 Subject: Add custom verb support for WASM HTTP requests The QNetworkReply implementation for Qt for WebAssembly now supports usage of the QNetworkAccessManager::sendCustomRequest, making it possible to send requests with custom verbs. [ChangeLog][QtNetwork][QNetworkAccessManager] Fixed QNetworkAccessManager::sendCustomRequest for Qt For WebAssembly. Fixes: QTBUG-76775 Change-Id: I9394ffef110fce4ed2c877893631bedc7631f71e Reviewed-by: Lorn Potter --- src/network/access/qnetworkreplywasmimpl.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/network') diff --git a/src/network/access/qnetworkreplywasmimpl.cpp b/src/network/access/qnetworkreplywasmimpl.cpp index 9f6422a107..ee91dc20b3 100644 --- a/src/network/access/qnetworkreplywasmimpl.cpp +++ b/src/network/access/qnetworkreplywasmimpl.cpp @@ -236,6 +236,7 @@ QNetworkReplyWasmImpl::~QNetworkReplyWasmImpl() QByteArray QNetworkReplyWasmImpl::methodName() const { + const Q_D( QNetworkReplyWasmImpl); switch (operation()) { case QNetworkAccessManager::HeadOperation: return "HEAD"; @@ -247,6 +248,8 @@ QByteArray QNetworkReplyWasmImpl::methodName() const return "POST"; case QNetworkAccessManager::DeleteOperation: return "DELETE"; + case QNetworkAccessManager::CustomOperation: + return d->request.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray(); default: break; } -- cgit v1.2.3