diff options
Diffstat (limited to 'src/network/socket')
33 files changed, 190 insertions, 156 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index e1a2449593..2e54a2d3ca 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -317,6 +317,10 @@ because the response from the proxy server could not be understood. \value OperationError An operation was attempted while the socket was in a state that did not permit it. + \value SslInternalError The SSL library being used reported a internal error, this is + probably the result of a bad installation or misconfiguration of the library. + \value SslInvalidUserDataError Invalid data(certificate, key, cypher, etc.) was + provided and its use resulted in an error in the SSL library. \value UnknownSocketError An unidentified error occurred. \sa QAbstractSocket::error() @@ -425,6 +429,19 @@ + ReuseAddressHint), and on Windows, its equivalent to ShareAddress. */ +/*! \enum QAbstractSocket::PauseMode + \since 5.0 + + This enum describes the behavior of when the socket should hold + back with continuing data transfer. + + \value PauseNever Do not pause data transfer on the socket. This is the + default and matches the behaviour of Qt 4. + \value PauseOnNotify Pause data transfer on the socket upon receiving a + notification. The only notification currently supported is + QSslSocket::sslErrors(). +*/ + #include "qabstractsocket.h" #include "qabstractsocket_p.h" @@ -529,6 +546,7 @@ QAbstractSocketPrivate::QAbstractSocketPrivate() abortCalled(false), closeCalled(false), pendingClose(false), + pauseMode(QAbstractSocket::PauseNever), port(0), localPort(0), peerPort(0), @@ -797,7 +815,7 @@ bool QAbstractSocketPrivate::flush() && socketEngine->bytesToWrite() == 0)) { #if defined (QABSTRACTSOCKET_DEBUG) qDebug("QAbstractSocketPrivate::flush() nothing to do: valid ? %s, writeBuffer.isEmpty() ? %s", - socketEngine->isValid() ? "yes" : "no", writeBuffer.isEmpty() ? "yes" : "no"); + (socketEngine && socketEngine->isValid()) ? "yes" : "no", writeBuffer.isEmpty() ? "yes" : "no"); #endif // this covers the case when the buffer was empty, but we had to wait for the socket engine to finish @@ -1354,6 +1372,55 @@ QAbstractSocket::~QAbstractSocket() /*! \since 5.0 + Continues data transfer on the socket. This method should only be used + after the socket has been set to pause upon notifications and a + notification has been received. + The only notification currently supported is QSslSocket::sslErrors(). + Calling this method if the socket is not paused results in undefined + behavior. + + \sa pauseMode(), setPauseMode() +*/ +void QAbstractSocket::resume() +{ + Q_D(QAbstractSocket); + d->resumeSocketNotifiers(this); +} + +/*! + \since 5.0 + + Returns the pause mode of this socket. + + \sa setPauseMode(), resume() +*/ +QAbstractSocket::PauseModes QAbstractSocket::pauseMode() const +{ + return d_func()->pauseMode; +} + + +/*! + \since 5.0 + + Controls whether to pause upon receiving a notification. The only notification + currently supported is QSslSocket::sslErrors(). If set to PauseOnNotify, + data transfer on the socket will be paused and needs to be enabled explicitly + again by calling resume(). + By default this option is set to PauseNever. + This option must be called before connecting to the server, otherwise it will + result in undefined behavior. + + \sa pauseMode(), resume() +*/ +void QAbstractSocket::setPauseMode(PauseModes pauseMode) +{ + d_func()->pauseMode = pauseMode; +} + +/*! + \since 5.0 + Binds to \a address on port \a port, using the BindMode \a mode. Binds this socket to the address \a address and the port \a port. @@ -1734,10 +1801,6 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState OpenMode openMode) { Q_D(QAbstractSocket); -#ifndef QT_NO_OPENSSL - if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) - return socket->setSocketDescriptor(socketDescriptor, socketState, openMode); -#endif d->resetSocketLayer(); d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDescriptor, this); @@ -1786,13 +1849,6 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState */ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) { -#ifndef QT_NO_OPENSSL - if (QSslSocket *sslSocket = qobject_cast<QSslSocket*>(this)) { - sslSocket->setSocketOption(option, value); - return; - } -#endif - if (!d_func()->socketEngine) return; @@ -1827,12 +1883,6 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons */ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option) { -#ifndef QT_NO_OPENSSL - if (QSslSocket *sslSocket = qobject_cast<QSslSocket*>(this)) { - return sslSocket->socketOption(option); - } -#endif - if (!d_func()->socketEngine) return QVariant(); @@ -1913,13 +1963,6 @@ bool QAbstractSocket::waitForConnected(int msecs) return true; } -#ifndef QT_NO_OPENSSL - // Manual polymorphism; this function is not virtual, but has an overload - // in QSslSocket. - if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) - return socket->waitForConnected(msecs); -#endif - bool wasPendingClose = d->pendingClose; d->pendingClose = false; QElapsedTimer stopWatch; @@ -2139,12 +2182,6 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) bool QAbstractSocket::waitForDisconnected(int msecs) { Q_D(QAbstractSocket); -#ifndef QT_NO_OPENSSL - // Manual polymorphism; this function is not virtual, but has an overload - // in QSslSocket. - if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) - return socket->waitForDisconnected(msecs); -#endif // require calling connectToHost() before waitForDisconnected() if (state() == UnconnectedState) { @@ -2756,15 +2793,6 @@ void QAbstractSocket::setReadBufferSize(qint64 size) { Q_D(QAbstractSocket); -#ifndef QT_NO_OPENSSL - // Manual polymorphism; setReadBufferSize() isn't virtual, but QSslSocket overloads - // it. - if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) { - socket->setReadBufferSize(size); - return; - } -#endif - if (d->readBufferMaxSize == size) return; d->readBufferMaxSize = size; diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h index e821f3ddb2..7a9f70b47e 100644 --- a/src/network/socket/qabstractsocket.h +++ b/src/network/socket/qabstractsocket.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -52,7 +52,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QHostAddress; #ifndef QT_NO_NETWORKPROXY @@ -98,6 +97,8 @@ public: ProxyNotFoundError, ProxyProtocolError, OperationError, + SslInternalError, /* 20 */ + SslInvalidUserDataError, UnknownSocketError = -1 }; @@ -124,10 +125,19 @@ public: ReuseAddressHint = 0x4 }; Q_DECLARE_FLAGS(BindMode, BindFlag) + enum PauseMode { + PauseNever = 0x0, + PauseOnNotify = 0x1 + }; + Q_DECLARE_FLAGS(PauseModes, PauseMode) QAbstractSocket(SocketType socketType, QObject *parent); virtual ~QAbstractSocket(); + virtual void resume(); // to continue after proxy authentication required, SSL errors etc. + PauseModes pauseMode() const; + void setPauseMode(PauseModes pauseMode); + bool bind(const QHostAddress &address, quint16 port = 0, BindMode mode = DefaultForPlatform); bool bind(quint16 port = 0, BindMode mode = DefaultForPlatform); @@ -148,20 +158,17 @@ public: QHostAddress peerAddress() const; QString peerName() const; - // ### Qt 5: Make setReadBufferSize() virtual qint64 readBufferSize() const; - void setReadBufferSize(qint64 size); + virtual void setReadBufferSize(qint64 size); void abort(); - // ### Qt 5: Make socketDescriptor() and setSocketDescriptor() virtual. - qintptr socketDescriptor() const; - bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState, + virtual qintptr socketDescriptor() const; + virtual bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState, OpenMode openMode = ReadWrite); - // ### Qt 5: Make virtual? - void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); - QVariant socketOption(QAbstractSocket::SocketOption option); + virtual void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value); + virtual QVariant socketOption(QAbstractSocket::SocketOption option); SocketType socketType() const; SocketState state() const; @@ -174,11 +181,10 @@ public: bool flush(); // for synchronous access - // ### Qt 5: Make waitForConnected() and waitForDisconnected() virtual. - bool waitForConnected(int msecs = 30000); + virtual bool waitForConnected(int msecs = 30000); bool waitForReadyRead(int msecs = 30000); bool waitForBytesWritten(int msecs = 30000); - bool waitForDisconnected(int msecs = 30000); + virtual bool waitForDisconnected(int msecs = 30000); #ifndef QT_NO_NETWORKPROXY void setProxy(const QNetworkProxy &networkProxy); @@ -223,6 +229,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSocket::BindMode) +Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSocket::PauseModes) #ifndef QT_NO_DEBUG_STREAM Q_NETWORK_EXPORT QDebug operator<<(QDebug, QAbstractSocket::SocketError); diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h index 49e7c82e21..578213f6de 100644 --- a/src/network/socket/qabstractsocket_p.h +++ b/src/network/socket/qabstractsocket_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -106,6 +106,8 @@ public: bool closeCalled; bool pendingClose; + QAbstractSocket::PauseModes pauseMode; + QString hostName; quint16 port; QHostAddress host; diff --git a/src/network/socket/qabstractsocketengine.cpp b/src/network/socket/qabstractsocketengine.cpp index 8c1ee88ce1..e9e49d41ec 100644 --- a/src/network/socket/qabstractsocketengine.cpp +++ b/src/network/socket/qabstractsocketengine.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h index e365eb8b5e..92d795408f 100644 --- a/src/network/socket/qabstractsocketengine_p.h +++ b/src/network/socket/qabstractsocketengine_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index e882f77dcd..93c5aaf7bd 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -43,7 +43,7 @@ #include "qtcpsocket.h" #include "qhostaddress.h" #include "qurl.h" -#include "private/qhttpheader_p.h" +#include "private/qhttpnetworkreply_p.h" #include "qelapsedtimer.h" #include "qnetworkinterface.h" @@ -72,6 +72,7 @@ bool QHttpSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSo setProtocol(protocol); setSocketType(type); d->socket = new QTcpSocket(this); + d->reply = new QHttpNetworkReply(QUrl(), this); #ifndef QT_NO_BEARERMANAGEMENT d->socket->setProperty("_q_networkSession", property("_q_networkSession")); #endif @@ -214,7 +215,7 @@ void QHttpSocketEngine::close() qint64 QHttpSocketEngine::bytesAvailable() const { Q_D(const QHttpSocketEngine); - return d->readBuffer.size() + (d->socket ? d->socket->bytesAvailable() : 0); + return d->socket ? d->socket->bytesAvailable() : 0; } qint64 QHttpSocketEngine::read(char *data, qint64 maxlen) @@ -567,20 +568,21 @@ void QHttpSocketEngine::slotSocketReadNotification() return; } - // Still in handshake mode. Wait until we've got a full response. - bool done = false; - do { - d->readBuffer += d->socket->readLine(); - } while (!(done = d->readBuffer.endsWith("\r\n\r\n")) && d->socket->canReadLine()); - - if (!done) { - // Wait for more. - return; + bool ok = true; + if (d->reply->d_func()->state == QHttpNetworkReplyPrivate::NothingDoneState) + d->reply->d_func()->state = QHttpNetworkReplyPrivate::ReadingStatusState; + if (d->reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingStatusState) { + ok = d->reply->d_func()->readStatus(d->socket) != -1; + if (ok && d->reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingStatusState) + return; //Not done parsing headers yet, wait for more data } - - if (!d->readBuffer.startsWith("HTTP/1.")) { + if (ok && d->reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingHeaderState) { + ok = d->reply->d_func()->readHeader(d->socket) != -1; + if (ok && d->reply->d_func()->state == QHttpNetworkReplyPrivate::ReadingHeaderState) + return; //Not done parsing headers yet, wait for more data + } + if (!ok) { // protocol error, this isn't HTTP - d->readBuffer.clear(); d->socket->close(); setState(QAbstractSocket::UnconnectedState); setError(QAbstractSocket::ProxyProtocolError, tr("Did not receive HTTP response from proxy")); @@ -588,10 +590,7 @@ void QHttpSocketEngine::slotSocketReadNotification() return; } - QHttpResponseHeader responseHeader(QString::fromLatin1(d->readBuffer)); - d->readBuffer.clear(); // we parsed the proxy protocol response. from now on direct socket reading will be done - - int statusCode = responseHeader.statusCode(); + int statusCode = d->reply->statusCode(); QAuthenticatorPrivate *priv = 0; if (statusCode == 200) { d->state = Connected; @@ -613,7 +612,7 @@ void QHttpSocketEngine::slotSocketReadNotification() d->authenticator.detach(); priv = QAuthenticatorPrivate::getPrivate(d->authenticator); - priv->parseHttpResponse(responseHeader, true); + priv->parseHttpResponse(d->reply->header(), true); if (priv->phase == QAuthenticatorPrivate::Invalid) { // problem parsing the reply @@ -625,21 +624,21 @@ void QHttpSocketEngine::slotSocketReadNotification() } bool willClose; - QString proxyConnectionHeader = responseHeader.value(QLatin1String("Proxy-Connection")); + QByteArray proxyConnectionHeader = d->reply->headerField("Proxy-Connection"); // Although most proxies use the unofficial Proxy-Connection header, the Connection header // from http spec is also allowed. if (proxyConnectionHeader.isEmpty()) - proxyConnectionHeader = responseHeader.value(QLatin1String("Connection")); + proxyConnectionHeader = d->reply->headerField("Connection"); proxyConnectionHeader = proxyConnectionHeader.toLower(); - if (proxyConnectionHeader == QLatin1String("close")) { + if (proxyConnectionHeader == "close") { willClose = true; - } else if (proxyConnectionHeader == QLatin1String("keep-alive")) { + } else if (proxyConnectionHeader == "keep-alive") { willClose = false; } else { // no Proxy-Connection header, so use the default // HTTP 1.1's default behaviour is to keep persistent connections // HTTP 1.0 or earlier, so we expect the server to close - willClose = (responseHeader.majorVersion() * 0x100 + responseHeader.minorVersion()) <= 0x0100; + willClose = (d->reply->majorVersion() * 0x100 + d->reply->minorVersion()) <= 0x0100; } if (willClose) { @@ -647,6 +646,9 @@ void QHttpSocketEngine::slotSocketReadNotification() // especially since the signal below may trigger a new event loop d->socket->disconnectFromHost(); d->socket->readAll(); + //We're done with the reply and need to reset it for the next connection + delete d->reply; + d->reply = new QHttpNetworkReply; } if (priv->phase == QAuthenticatorPrivate::Done) @@ -662,7 +664,7 @@ void QHttpSocketEngine::slotSocketReadNotification() d->socket->connectToHost(d->proxy.hostName(), d->proxy.port()); } else { bool ok; - int contentLength = responseHeader.value(QLatin1String("Content-Length")).toInt(&ok); + int contentLength = d->reply->headerField("Content-Length").toInt(&ok); if (ok && contentLength > 0) { d->state = ReadResponseContent; d->pendingResponseData = contentLength; @@ -708,7 +710,6 @@ void QHttpSocketEngine::slotSocketBytesWritten() void QHttpSocketEngine::slotSocketError(QAbstractSocket::SocketError error) { Q_D(QHttpSocketEngine); - d->readBuffer.clear(); if (d->state != Connected) { // we are in proxy handshaking stages @@ -811,6 +812,7 @@ QHttpSocketEnginePrivate::QHttpSocketEnginePrivate() , pendingResponseData(0) { socket = 0; + reply = 0; state = QHttpSocketEngine::None; } diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h index 1a93956bd2..a6e8b99310 100644 --- a/src/network/socket/qhttpsocketengine_p.h +++ b/src/network/socket/qhttpsocketengine_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -63,6 +63,7 @@ QT_BEGIN_NAMESPACE #if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) class QTcpSocket; +class QHttpNetworkReply; class QHttpSocketEnginePrivate; class Q_AUTOTEST_EXPORT QHttpSocketEngine : public QAbstractSocketEngine @@ -171,7 +172,7 @@ public: QNetworkProxy proxy; QString peerName; QTcpSocket *socket; - QByteArray readBuffer; // only used for parsing the proxy response + QHttpNetworkReply *reply; // only used for parsing the proxy response QHttpSocketEngine::HttpState state; QAuthenticator authenticator; bool readNotificationEnabled; diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp index fc5fe3443e..b3fe4ac448 100644 --- a/src/network/socket/qlocalserver.cpp +++ b/src/network/socket/qlocalserver.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h index 6887c16056..f694131953 100644 --- a/src/network/socket/qlocalserver.h +++ b/src/network/socket/qlocalserver.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -48,7 +48,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) #ifndef QT_NO_LOCALSERVER diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h index d762818692..6e39136dd4 100644 --- a/src/network/socket/qlocalserver_p.h +++ b/src/network/socket/qlocalserver_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalserver_tcp.cpp b/src/network/socket/qlocalserver_tcp.cpp index cb4ee53f6a..d6c6a1af92 100644 --- a/src/network/socket/qlocalserver_tcp.cpp +++ b/src/network/socket/qlocalserver_tcp.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index 5859ab0080..c4482dadfc 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp index bdbe4d74f1..67e319cdbb 100644 --- a/src/network/socket/qlocalserver_win.cpp +++ b/src/network/socket/qlocalserver_win.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index e311f6a060..3097eaa96c 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h index bb39b0f4c8..f8bb556413 100644 --- a/src/network/socket/qlocalsocket.h +++ b/src/network/socket/qlocalsocket.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) #ifndef QT_NO_LOCALSOCKET diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h index 3541d950e8..cb21a7f3e7 100644 --- a/src/network/socket/qlocalsocket_p.h +++ b/src/network/socket/qlocalsocket_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index 3b83d0ee01..fb9011f0f2 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index 5bd929d477..52d8b05a6f 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 99942a6138..35b0130afc 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -108,8 +108,8 @@ void QLocalSocketPrivate::_q_winError(ulong windowsError, const QString &functio QLocalSocketPrivate::QLocalSocketPrivate() : QIODevicePrivate(), handle(INVALID_HANDLE_VALUE), - pipeReader(0), pipeWriter(0), + pipeReader(0), error(QLocalSocket::UnknownSocketError), state(QLocalSocket::UnconnectedState) { diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index cae2469328..a34b19f7ef 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 60c13c1258..a48fcfa769 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 324705d998..b7c149c18d 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index ee15702b76..e57bfcb52b 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -732,6 +732,8 @@ bool QNativeSocketEnginePrivate::nativeBind(const QHostAddress &a, quint16 port) ipv6only = 1; ipv6only = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, sizeof(ipv6only) ); } +#else + Q_UNUSED(ipv6only) #endif break; case QAbstractSocket::IPv4Protocol: @@ -1335,10 +1337,10 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) #if defined (QNATIVESOCKETENGINE_DEBUG) if (ret != -2) { - qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %l) == %li", + qDebug("QNativeSocketEnginePrivate::nativeRead(%p \"%s\", %li) == %li", data, qt_prettyDebug(data, qMin((int)bytesRead, 16), (int)bytesRead).data(), (int)maxLength, (int)ret); } else { - qDebug("QNativeSocketEnginePrivate::nativeRead(%p, %l) == -2 (WOULD BLOCK)", + qDebug("QNativeSocketEnginePrivate::nativeRead(%p, %li) == -2 (WOULD BLOCK)", data, int(maxLength)); } #endif diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 7b2ba54648..651bd1816d 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 919bdea2e0..76b00bc4a9 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h index 386e4856a1..662ce0d347 100644 --- a/src/network/socket/qsocks5socketengine_p.h +++ b/src/network/socket/qsocks5socketengine_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qtcpserver.cpp b/src/network/socket/qtcpserver.cpp index 857827facc..42f0056524 100644 --- a/src/network/socket/qtcpserver.cpp +++ b/src/network/socket/qtcpserver.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h index a322294f58..71ccefa496 100644 --- a/src/network/socket/qtcpserver.h +++ b/src/network/socket/qtcpserver.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -50,7 +50,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QTcpServerPrivate; #ifndef QT_NO_NETWORKPROXY diff --git a/src/network/socket/qtcpsocket.cpp b/src/network/socket/qtcpsocket.cpp index f900ca752c..706f5721b2 100644 --- a/src/network/socket/qtcpsocket.cpp +++ b/src/network/socket/qtcpsocket.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h index aa2e89d840..0150205198 100644 --- a/src/network/socket/qtcpsocket.h +++ b/src/network/socket/qtcpsocket.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) class QTcpSocketPrivate; diff --git a/src/network/socket/qtcpsocket_p.h b/src/network/socket/qtcpsocket_p.h index 33672539cc..92d8418acf 100644 --- a/src/network/socket/qtcpsocket_p.h +++ b/src/network/socket/qtcpsocket_p.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/src/network/socket/qudpsocket.cpp b/src/network/socket/qudpsocket.cpp index f378fea7b9..a31b16e97d 100644 --- a/src/network/socket/qudpsocket.cpp +++ b/src/network/socket/qudpsocket.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -318,9 +318,6 @@ qint64 QUdpSocket::pendingDatagramSize() const fragmented by the IP layer before arriving at their final destination. - \warning In S60 5.0 and earlier versions, the writeDatagram return - value is not reliable for large datagrams. - \warning Calling this function on a connected UDP socket may result in an error and no packet being sent. If you are using a connected socket, use write() to send datagrams. diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h index ed5f539732..d1023f57c5 100644 --- a/src/network/socket/qudpsocket.h +++ b/src/network/socket/qudpsocket.h @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtNetwork module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -49,7 +49,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Network) #ifndef QT_NO_UDPSOCKET |