diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 4 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkrequest.cpp | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkreplynsurlconnectionimpl.mm | 1 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 11 | ||||
-rw-r--r-- | src/network/socket/qlocalserver_tcp.cpp | 2 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 66 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_winrt.cpp | 4 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 10 |
9 files changed, 82 insertions, 22 deletions
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index cf786e37c6..accad6e4c0 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -377,6 +377,8 @@ void QHttpNetworkConnectionPrivate::emitReplyError(QAbstractSocket *socket, // Clean the channel channels[i].close(); channels[i].reply = 0; + if (channels[i].protocolHandler) + channels[i].protocolHandler->setReply(0); channels[i].request = QHttpNetworkRequest(); if (socket) channels[i].requeueCurrentlyPipelinedRequests(); @@ -826,6 +828,8 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) // is the reply associated the currently processing of this channel? if (channels[i].reply == reply) { channels[i].reply = 0; + if (channels[i].protocolHandler) + channels[i].protocolHandler->setReply(0); channels[i].request = QHttpNetworkRequest(); channels[i].resendCurrent = false; diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 2a7e6ed638..b057fee144 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -363,7 +363,7 @@ bool QHttpNetworkReplyPrivate::isCompressed() void QHttpNetworkReplyPrivate::removeAutoDecompressHeader() { // The header "Content-Encoding = gzip" is retained. - // Content-Length is removed since the actual one send by the server is for compressed data + // Content-Length is removed since the actual one sent by the server is for compressed data QByteArray name("content-length"); QList<QPair<QByteArray, QByteArray> >::Iterator it = fields.begin(), end = fields.end(); @@ -921,7 +921,7 @@ qint64 QHttpNetworkReplyPrivate::getChunkSize(QAbstractSocket *socket, qint64 *c bool QHttpNetworkReplyPrivate::shouldEmitSignals() { // for 401 & 407 don't emit the data signals. Content along with these - // responses are send only if the authentication fails. + // responses are sent only if the authentication fails. return (statusCode != 401 && statusCode != 407); } diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp index 6e9f1216c3..8ad04c9885 100644 --- a/src/network/access/qhttpnetworkrequest.cpp +++ b/src/network/access/qhttpnetworkrequest.cpp @@ -120,7 +120,7 @@ QByteArray QHttpNetworkRequest::uri(bool throughProxy) const { QUrl::FormattingOptions format(QUrl::RemoveFragment | QUrl::RemoveUserInfo | QUrl::FullyEncoded); - // for POST, query data is send as content + // for POST, query data is sent as content if (d->operation == QHttpNetworkRequest::Post && !d->uploadByteDevice) format |= QUrl::RemoveQuery; // for requests through proxy, the Request-URI contains full url diff --git a/src/network/access/qnetworkreplynsurlconnectionimpl.mm b/src/network/access/qnetworkreplynsurlconnectionimpl.mm index 293a505912..d49324918e 100644 --- a/src/network/access/qnetworkreplynsurlconnectionimpl.mm +++ b/src/network/access/qnetworkreplynsurlconnectionimpl.mm @@ -128,6 +128,7 @@ QNetworkReplyNSURLConnectionImplPrivate::QNetworkReplyNSURLConnectionImplPrivate QNetworkReplyNSURLConnectionImplPrivate::~QNetworkReplyNSURLConnectionImplPrivate() { + [urlConnection cancel]; [urlConnection release]; [urlConnectionDelegate release]; if (readStream) diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index edbbbf5a75..f7b956651f 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -981,7 +981,7 @@ public: QNtlmPhase1Block() { qstrncpy(magic, "NTLMSSP", 8); type = 1; - flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_REQUEST_TARGET; + flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_ALWAYS_SIGN | NTLMSSP_NEGOTIATE_NTLM2; } // extracted @@ -1423,9 +1423,16 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas ds.setByteOrder(QDataStream::LittleEndian); QNtlmPhase3Block pb; + // set NTLMv2 + if (ch.flags & NTLMSSP_NEGOTIATE_NTLM2) + pb.flags |= NTLMSSP_NEGOTIATE_NTLM2; + + // set Always Sign + if (ch.flags & NTLMSSP_NEGOTIATE_ALWAYS_SIGN) + pb.flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN; + bool unicode = ch.flags & NTLMSSP_NEGOTIATE_UNICODE; - pb.flags = NTLMSSP_NEGOTIATE_NTLM; if (unicode) pb.flags |= NTLMSSP_NEGOTIATE_UNICODE; else diff --git a/src/network/socket/qlocalserver_tcp.cpp b/src/network/socket/qlocalserver_tcp.cpp index 39e7babf71..de4acd9111 100644 --- a/src/network/socket/qlocalserver_tcp.cpp +++ b/src/network/socket/qlocalserver_tcp.cpp @@ -80,8 +80,6 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName) bool QLocalServerPrivate::listen(qintptr socketDescriptor) { - Q_Q(QLocalServer); - return tcpServer.setSocketDescriptor(socketDescriptor); } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 11a14359d7..0181b9965a 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -363,7 +363,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint16 port) { #ifdef QNATIVESOCKETENGINE_DEBUG - qDebug("QNativeSocketEnginePrivate::nativeConnect() : %d ", socketDescriptor); + qDebug("QNativeSocketEnginePrivate::nativeConnect() : %lli", socketDescriptor); #endif struct sockaddr_in sockAddrIPv4; @@ -856,7 +856,7 @@ qint64 QNativeSocketEnginePrivate::nativePendingDatagramSize() const } #if defined (QNATIVESOCKETENGINE_DEBUG) - qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %i", recvResult); + qDebug("QNativeSocketEnginePrivate::nativePendingDatagramSize() == %zd", recvResult); #endif return qint64(recvResult); @@ -1021,13 +1021,13 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() socketType = QAbstractSocket::UnknownSocketType; } #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() local == %s:%i," " peer == %s:%i, socket == %s - %s", @@ -1121,7 +1121,7 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize) } #if defined (QNATIVESOCKETENGINE_DEBUG) - qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %llu) == %i", + qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %llu) == %zd", data, qt_prettyDebug(data, qMin(r, ssize_t(16)), r).data(), maxSize, r); #endif @@ -1129,6 +1129,53 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize) return qint64(r); } +#ifdef Q_OS_BLACKBERRY +int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const +{ + fd_set fds; + FD_ZERO(&fds); + FD_SET(socketDescriptor, &fds); + + int retval; + QList<QSocketNotifier *> notifiers; + if (selectForRead) { + notifiers << readNotifier; + retval = bb_select(notifiers, socketDescriptor + 1, &fds, 0, timeout); + } else { + notifiers << writeNotifier; + retval = bb_select(notifiers, socketDescriptor + 1, 0, &fds, timeout); + } + + return retval; +} + +int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite, + bool *selectForRead, bool *selectForWrite) const +{ + fd_set fdread; + FD_ZERO(&fdread); + if (checkRead) + FD_SET(socketDescriptor, &fdread); + + fd_set fdwrite; + FD_ZERO(&fdwrite); + if (checkWrite) + FD_SET(socketDescriptor, &fdwrite); + + QList<QSocketNotifier *> notifiers; + notifiers << readNotifier << writeNotifier; + int ret = bb_select(notifiers, socketDescriptor + 1, &fdread, &fdwrite, timeout); + + if (ret <= 0) + return ret; + *selectForRead = FD_ISSET(socketDescriptor, &fdread); + *selectForWrite = FD_ISSET(socketDescriptor, &fdwrite); + + return ret; +} + +#else // not Q_OS_BLACKBERRY: + int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const { fd_set fds; @@ -1175,5 +1222,6 @@ int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool c return ret; } +#endif // Q_OS_BLACKBERRY QT_END_NAMESPACE diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 2a61325471..4b2d1c372e 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -549,9 +549,9 @@ qint64 QNativeSocketEngine::write(const char *data, qint64 len) Q_D(QNativeSocketEngine); qint64 bytesWritten = -1; if (d->socketType == QAbstractSocket::TcpSocket) - bytesWritten = ::nativeWrite(d->tcp, data, len); + bytesWritten = nativeWrite(d->tcp, data, len); else if (d->socketType == QAbstractSocket::UdpSocket) - bytesWritten = ::nativeWrite(d->udp, data, len); + bytesWritten = nativeWrite(d->udp, data, len); if (bytesWritten != -1 && d->notifyOnWrite) writeNotification(); return bytesWritten; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 4360a13b51..cd64b9ec43 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1519,11 +1519,13 @@ void QSslSocketBackendPrivate::continueHandshake() } #if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) - const unsigned char *proto; - unsigned int proto_len; + const unsigned char *proto = 0; + unsigned int proto_len = 0; q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); - QByteArray nextProtocol(reinterpret_cast<const char *>(proto), proto_len); - configuration.nextNegotiatedProtocol = nextProtocol; + if (proto_len) + configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast<const char *>(proto), proto_len); + else + configuration.nextNegotiatedProtocol.clear(); configuration.nextProtocolNegotiationStatus = sslContextPointer->npnContext().status; #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... |