void DownloadManager::sslErrors(const QList<QSslError> &sslErrors)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
foreach (const QSslError &error, sslErrors)
fprintf(stderr, "SSL error: %s\n", qPrintable(error.errorString()));
#endif
HttpWindow::HttpWindow(QWidget *parent)
: QDialog(parent)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
urlLineEdit = new QLineEdit("https://qt.nokia.com/");
#else
urlLineEdit = new QLineEdit("http://qt.nokia.com/");
connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
connect(&qnam, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
}
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
{
QString errorString;
void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
void enableDownloadButton();
void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
#endif
#ifndef QT_NO_HTTP
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
# include <private/qsslsocket_p.h>
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
// Disable all socket notifiers
for (int i = 0; i < channelCount; i++) {
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (encrypt)
QSslSocketPrivate::pauseSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
else
state = RunningState;
// Enable all socket notifiers
for (int i = 0; i < channelCount; i++) {
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (encrypt)
QSslSocketPrivate::resumeSocketNotifiers(static_cast<QSslSocket*>(channels[i].socket));
else
// SSL support below
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void QHttpNetworkConnection::setSslConfiguration(const QSslConfiguration &config)
{
Q_D(QHttpNetworkConnection);
}
}
-#endif //QT_NO_OPENSSL
+#endif //QT_NO_SSL
#ifndef QT_NO_NETWORKPROXY
// only called from QHttpNetworkConnectionChannel::_q_proxyAuthenticationRequired, not
#ifndef QT_NO_HTTP
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
# include <QtNetwork/qsslsocket.h>
# include <QtNetwork/qsslerror.h>
#else
QHttpNetworkConnectionChannel *channels() const;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void setSslConfiguration(const QSslConfiguration &config);
void ignoreSslErrors(int channel = -1);
void ignoreSslErrors(const QList<QSslError> &errors, int channel = -1);
#ifndef QT_NO_HTTP
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
# include <QtNetwork/qsslconfiguration.h>
, proxyAuthMethod(QAuthenticatorPrivate::None)
, authenticationCredentialsSent(false)
, proxyCredentialsSent(false)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
, ignoreAllSslErrors(false)
#endif
, pipeliningSupported(PipeliningSupportUnknown)
void QHttpNetworkConnectionChannel::init()
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (connection->d_func()->encrypt)
socket = new QSslSocket;
else
Qt::DirectConnection);
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
if (sslSocket) {
// won't be a sslSocket if encrypt is false
const qint64 socketWriteMaxSize = 16*1024;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
// if it is really an ssl socket, check more than just bytesToWrite()
while ((socket->bytesToWrite() + (sslSocket ? sslSocket->encryptedBytesToWrite() : 0))
}
#endif
if (ssl) {
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
sslSocket->connectToHostEncrypted(connectHost, connectPort, QIODevice::ReadWrite, networkLayerPreference);
if (ignoreAllSslErrors)
sendRequest();
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void QHttpNetworkConnectionChannel::_q_encrypted()
{
if (!socket)
#ifndef QT_NO_HTTP
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
# include <QtNetwork/qsslsocket.h>
# include <QtNetwork/qsslerror.h>
#else
QAuthenticator proxyAuthenticator;
bool authenticationCredentialsSent;
bool proxyCredentialsSent;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
bool ignoreAllSslErrors;
QList<QSslError> ignoreSslErrorsList;
#endif
void _q_uploadDataReadyRead();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void _q_encrypted(); // start sending request (https)
void _q_sslErrors(const QList<QSslError> &errors); // ssl errors from the socket
void _q_encryptedBytesWritten(qint64 bytes); // proceed sending
#ifndef QT_NO_HTTP
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
# include <QtNetwork/qsslconfiguration.h>
// SSL support below
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration QHttpNetworkReply::sslConfiguration() const
{
}
-#endif //QT_NO_OPENSSL
+#endif //QT_NO_SSL
QT_END_NAMESPACE
QHttpNetworkConnection* connection();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration sslConfiguration() const;
void setSslConfiguration(const QSslConfiguration &config);
void ignoreSslErrors();
#else
httpConnection = new QNetworkAccessCachedHttpConnection(urlCopy.host(), urlCopy.port(), ssl, networkSession);
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
// Set the QSslConfiguration from this QNetworkRequest.
if (ssl && incomingSslConfiguration != QSslConfiguration::defaultConfiguration()) {
httpConnection->setSslConfiguration(incomingSslConfiguration);
// some signals are only interesting when normal asynchronous style is used
connect(httpReply,SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
connect(httpReply,SIGNAL(dataReadProgress(qint64, qint64)), this, SLOT(dataReadProgressSlot(qint64,qint64)));
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
connect(httpReply,SIGNAL(sslErrors(const QList<QSslError>)), this, SLOT(sslErrorsSlot(QList<QSslError>)));
#endif
emit downloadData(httpReply->readAny());
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (ssl)
emit sslConfigurationChanged(httpReply->sslConfiguration());
#endif
qDebug() << "QHttpThreadDelegate::finishedWithErrorSlot() thread=" << QThread::currentThreadId() << "error=" << errorCode << detail;
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (ssl)
emit sslConfigurationChanged(httpReply->sslConfiguration());
#endif
qDebug() << "QHttpThreadDelegate::headerChangedSlot() thread=" << QThread::currentThreadId();
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (ssl)
emit sslConfigurationChanged(httpReply->sslConfiguration());
#endif
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void QHttpThreadDelegate::sslErrorsSlot(const QList<QSslError> &errors)
{
emit sslConfigurationChanged(httpReply->sslConfiguration());
// incoming
bool ssl;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration incomingSslConfiguration;
#endif
QHttpNetworkRequest httpRequest;
#ifndef QT_NO_NETWORKPROXY
void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *);
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrors(const QList<QSslError> &, bool *, QList<QSslError> *);
void sslConfigurationChanged(const QSslConfiguration);
#endif
void synchronousHeaderChangedSlot();
void dataReadProgressSlot(qint64 done, qint64 total);
void cacheCredentialsSlot(const QHttpNetworkRequest &request, QAuthenticator *authenticator);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrorsSlot(const QList<QSslError> &errors);
#endif
void QNetworkAccessBackend::sslErrors(const QList<QSslError> &errors)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
reply->sslErrors(errors);
#else
Q_UNUSED(errors);
#ifndef QT_NO_NETWORKPROXY
qRegisterMetaType<QNetworkProxy>("QNetworkProxy");
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
qRegisterMetaType<QList<QSslError> >("QList<QSslError>");
qRegisterMetaType<QSslConfiguration>("QSslConfiguration");
#endif
priv->backend->reply = priv;
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
reply->setSslConfiguration(request.sslConfiguration());
#endif
void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList<QSslError> &errors)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
Q_Q(QNetworkAccessManager);
QNetworkReply *reply = qobject_cast<QNetworkReply *>(q->sender());
if (reply)
Q_Q(QNetworkAccessManager);
QNetworkReplyPrivate::setManager(reply, q);
q->connect(reply, SIGNAL(finished()), SLOT(_q_replyFinished()));
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
/* In case we're compiled without SSL support, we don't have this signal and we need to
* avoid getting a connection error. */
q->connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(_q_replySslErrors(QList<QSslError>)));
#endif
void authenticationRequired(QNetworkReply *reply, QAuthenticator *authenticator);
void finished(QNetworkReply *reply);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
#endif
return d_func()->attributes.value(code);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
/*!
Returns the SSL configuration and state associated with this
reply, if SSL was used. It will contain the remote server's
// attributes
QVariant attribute(QNetworkRequest::Attribute code) const;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration sslConfiguration() const;
void setSslConfiguration(const QSslConfiguration &configuration);
void ignoreSslErrors(const QList<QSslError> &errors);
void metaDataChanged();
void finished();
void error(QNetworkReply::NetworkError);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrors(const QList<QSslError> &errors);
#endif
d->operation = operation;
d->outgoingData = outgoingData;
d->url = request.url();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
d->sslConfiguration = request.sslConfiguration();
#endif
return d->downloadMultiBuffer.canReadLine();
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void QNetworkReplyHttpImpl::ignoreSslErrors()
{
Q_D(QNetworkReplyHttpImpl);
, downloadZerocopyBuffer(0)
, pendingDownloadDataEmissions(new QAtomicInt())
, pendingDownloadProgressEmissions(new QAtomicInt())
- #ifndef QT_NO_OPENSSL
+ #ifndef QT_NO_SSL
, pendingIgnoreAllSslErrors(false)
#endif
delegate->transparentProxy = transparentProxy;
#endif
delegate->ssl = ssl;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (ssl)
delegate->incomingSslConfiguration = request.sslConfiguration();
#endif
QObject::connect(delegate, SIGNAL(error(QNetworkReply::NetworkError,QString)),
q, SLOT(httpError(QNetworkReply::NetworkError, const QString)),
Qt::QueuedConnection);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QObject::connect(delegate, SIGNAL(sslConfigurationChanged(QSslConfiguration)),
q, SLOT(replySslConfigurationChanged(QSslConfiguration)),
Qt::QueuedConnection);
q, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
Qt::BlockingQueuedConnection);
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QObject::connect(delegate, SIGNAL(sslErrors(QList<QSslError>,bool*,QList<QSslError>*)),
q, SLOT(replySslErrors(const QList<QSslError> &, bool *, QList<QSslError> *)),
Qt::BlockingQueuedConnection);
error(errorCode, errorString);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void QNetworkReplyHttpImplPrivate::replySslErrors(
const QList<QSslError> &list, bool *ignoreAll, QList<QSslError> *toBeIgnored)
{
#include <private/qnetworkreply_p.h>
#include <QtNetwork/QNetworkProxy>
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
#include <QtNetwork/QSslConfiguration>
#endif
Q_PRIVATE_SLOT(d_func(), void replyDownloadProgressSlot(qint64,qint64))
Q_PRIVATE_SLOT(d_func(), void httpAuthenticationRequired(const QHttpNetworkRequest &, QAuthenticator *))
Q_PRIVATE_SLOT(d_func(), void httpError(QNetworkReply::NetworkError, const QString &))
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
Q_PRIVATE_SLOT(d_func(), void replySslErrors(const QList<QSslError> &, bool *, QList<QSslError> *))
Q_PRIVATE_SLOT(d_func(), void replySslConfigurationChanged(const QSslConfiguration&))
#endif
Q_PRIVATE_SLOT(d_func(), void emitReplyUploadProgress(qint64, qint64))
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
protected:
void ignoreSslErrors();
void ignoreSslErrorsImplementation(const QList<QSslError> &errors);
QSharedPointer<QAtomicInt> pendingDownloadProgressEmissions;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration sslConfiguration;
bool pendingIgnoreAllSslErrors;
QList<QSslError> pendingIgnoreSslErrorsList;
void replyDownloadProgressSlot(qint64,qint64);
void httpAuthenticationRequired(const QHttpNetworkRequest &request, QAuthenticator *auth);
void httpError(QNetworkReply::NetworkError error, const QString &errorString);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void replySslErrors(const QList<QSslError> &, bool *, QList<QSslError> *);
void replySslConfigurationChanged(const QSslConfiguration&);
#endif
void QNetworkReplyImplPrivate::sslErrors(const QList<QSslError> &errors)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
Q_Q(QNetworkReplyImpl);
emit q->sslErrors(errors);
#else
d->backend->setDownstreamLimited(d->readBufferMaxSize > 0);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void QNetworkReplyImpl::sslConfigurationImplementation(QSslConfiguration &configuration) const
{
Q_D(const QNetworkReplyImpl);
if (d->backend)
d->backend->ignoreSslErrors(errors);
}
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
/*!
\internal
Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed())
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
protected:
void sslConfigurationImplementation(QSslConfiguration &configuration) const;
void setSslConfigurationImplementation(const QSslConfiguration &configuration);
public:
inline QNetworkRequestPrivate()
: priority(QNetworkRequest::NormalPriority)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
, sslConfiguration(0)
#endif
{ qRegisterMetaType<QNetworkRequest>(); }
~QNetworkRequestPrivate()
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
delete sslConfiguration;
#endif
}
url = other.url;
priority = other.priority;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
sslConfiguration = 0;
if (other.sslConfiguration)
sslConfiguration = new QSslConfiguration(*other.sslConfiguration);
QUrl url;
QNetworkRequest::Priority priority;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
mutable QSslConfiguration *sslConfiguration;
#endif
};
d->attributes.remove(code);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
/*!
Returns this network request's SSL configuration. By default, no
SSL settings are specified.
QVariant attribute(Attribute code, const QVariant &defaultValue = QVariant()) const;
void setAttribute(Attribute code, const QVariant &value);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration sslConfiguration() const;
void setSslConfiguration(const QSslConfiguration &configuration);
#endif
#include <qelapsedtimer.h>
#include <qscopedvaluerollback.h>
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
#include <QtNetwork/qsslsocket.h>
#endif
#endif
if (d->state == UnconnectedState)
return;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (QSslSocket *socket = qobject_cast<QSslSocket *>(this)) {
socket->abort();
return;
bool QAbstractSocket::flush()
{
Q_D(QAbstractSocket);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
// Manual polymorphism; flush() isn't virtual, but QSslSocket overloads
// it.
if (QSslSocket *socket = qobject_cast<QSslSocket *>(this))
QT_END_NAMESPACE
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
Q_DECLARE_METATYPE(QList<QSslError>)
#endif
void finishedReply();
void finishedWithError(QNetworkReply::NetworkError errorCode, const QString &detail);
void challenge401(const QHttpNetworkRequest &request, QAuthenticator *authenticator);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrors(const QList<QSslError> &errors);
#endif
private:
void compression_data();
void compression();
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void ignoresslerror_data();
void ignoresslerror();
#endif
-#ifdef QT_NO_OPENSSL
+#ifdef QT_NO_SSL
void nossl_data();
void nossl();
#endif
}
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QHttpNetworkConnection::sslErrors(const QList<QSslError> &errors)
{
Q_UNUSED(errors)
}
#endif
-#ifdef QT_NO_OPENSSL
+#ifdef QT_NO_SSL
Q_DECLARE_METATYPE(QNetworkReply::NetworkError)
void tst_QHttpNetworkConnection::nossl_data()
{
#include <QtNetwork/QHttpPart>
#include <QtNetwork/QHttpMultiPart>
#include <QtNetwork/QNetworkProxyQuery>
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
#include <QtNetwork/qsslerror.h>
#include <QtNetwork/qsslconfiguration.h>
#endif
Q_DECLARE_METATYPE(QBuffer*)
Q_DECLARE_METATYPE(QHttpMultiPart *)
Q_DECLARE_METATYPE(QList<QFile*>) // for multiparts
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
Q_DECLARE_METATYPE(QSslConfiguration)
#endif
QList<ProxyData> proxies;
QNetworkAccessManager manager;
MyCookieJar *cookieJar;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslConfiguration storedSslConfiguration;
QList<QSslError> storedExpectedSslErrors;
#endif
void proxyAuthenticationRequired(const QNetworkProxy &,QAuthenticator*);
void pipeliningHelperSlot();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void sslErrors(QNetworkReply*,const QList<QSslError> &);
void storeSslConfiguration();
void ignoreSslErrorListSlot(QNetworkReply *reply, const QList<QSslError> &);
void ioGetFromHttpWithProxyAuth();
void ioGetFromHttpWithProxyAuthSynchronous();
void ioGetFromHttpWithSocksProxy();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void ioGetFromHttpsWithSslErrors();
void ioGetFromHttpsWithIgnoreSslErrors();
void ioGetFromHttpsWithSslHandshakeError();
void httpRecursiveCreation();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void ioPostToHttpsUploadProgress();
void ignoreSslErrorsList_data();
void ignoreSslErrorsList();
void synchronousRequest_data();
void synchronousRequest();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void synchronousRequestSslFailure();
#endif
QFAIL(qPrintable(errorMsg)); \
} while (0);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
static void setupSslServer(QSslSocket* serverSocket)
{
QString testDataDir = QFileInfo(QFINDTESTDATA("rfc3252.txt")).absolutePath();
client->setSocketDescriptor(socketDescriptor);
connectSocketSignals();
} else {
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket *serverSocket = new QSslSocket;
serverSocket->setParent(this);
if (serverSocket->setSocketDescriptor(socketDescriptor)) {
}
private slots:
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void slotSslErrors(const QList<QSslError>& errors)
{
qDebug() << "slotSslErrors" << client->errorString() << errors;
}
virtual void incomingConnection(qintptr socketDescriptor)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
if (doSsl) {
QSslSocket *serverSocket = new QSslSocket;
serverSocket->setParent(this);
}
private slots:
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void slotSslErrors(const QList<QSslError>& errors)
{
qDebug() << "slotSslErrors" << sslSocket->errorString() << errors;
qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy
qRegisterMetaType<QAuthenticator *>();
qRegisterMetaType<QNetworkProxy>();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
qRegisterMetaType<QList<QSslError> >();
#endif
qRegisterMetaType<QNetworkReply::NetworkError>();
auth->setPassword("password");
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QNetworkReply::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{
reply->ignoreSslErrors();
#endif
QDir::setSearchPaths("testdata", QStringList() << testDataDir);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket::defaultCaCertificates(); //preload certificates
#endif
#ifndef QT_NO_BEARERMANAGEMENT
}
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QNetworkReply::ioGetFromHttpsWithSslErrors()
{
qRegisterMetaType<QNetworkReply*>(); // for QSignalSpy
<< "ftp://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"
<< QNetworkReply::NoError;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
// HTTPS with HTTP transparent proxy
proxyList.clear();
proxyList << QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3129);
<< "ftp://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"
<< QNetworkReply::ProxyNotFoundError;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
// HTTPS with HTTP caching proxy
proxyList.clear();
proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129);
<< "ftp://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"
<< QNetworkReply::NoError;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
// HTTPS request with HTTP Caching + HTTP transparent
proxyList.clear();
proxyList << QNetworkProxy(QNetworkProxy::HttpCachingProxy, QtNetworkSettings::serverName(), 3129)
QSignalSpy authspy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
connect(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
connect(&manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
manager.disconnect(SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
this, SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
manager.disconnect(SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
QCOMPARE(reply->error(), QNetworkReply::ContentReSendError);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class SslServer : public QTcpServer {
Q_OBJECT
public:
QTest::addColumn<int>("bufferSize");
QTest::newRow("http+unlimited") << false << 0;
QTest::newRow("http+limited") << false << 4096;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QTest::newRow("https+unlimited") << true << 0;
QTest::newRow("https+limited") << true << 4096;
#endif
<< QUrl("http://0.0.0.0:4443/http-request")
<< QByteArray("HTTP/1.0 200 OK\r\nProxy-Connection: close\r\nContent-Length: 1\r\n\r\n1")
<< "GET http://0.0.0.0:4443/http-request HTTP/1.";
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QTest::newRow("https")
<< QUrl("https://0.0.0.0:4443/https-request")
<< QByteArray("HTTP/1.0 200 Connection Established\r\n\r\n")
QVERIFY(!QTestEventLoop::instance().timeout());
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QNetworkReply::ignoreSslErrorsList_data()
{
QTest::addColumn<QString>("url");
QCOMPARE(reply->error(), expectedError);
}
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
void tst_QNetworkReply::getAndThenDeleteObject_data()
{
QTest::addColumn<QUrl>("url");
for (int i = 0; i < proxies.count(); ++i) {
QTest::newRow("http" + proxies.at(i).tag) << proxies.at(i).proxy << proxies.at(i).requiresAuthentication << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt");
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QTest::newRow("https" + proxies.at(i).tag) << proxies.at(i).proxy << proxies.at(i).requiresAuthentication << QUrl("https://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt");
#endif
}
QFETCH(bool, proxyAuth);
QFETCH(QUrl, url);
QNetworkAccessManager manager;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
connect(&manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
{
AuthenticationCacheHelper helper;
QNetworkAccessManager manager;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
connect(&manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
#endif
// ### we would need to enflate (un-deflate) the file content and compare the sizes
<< QString("text/plain");
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QTest::newRow("https")
<< QUrl("https://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt")
<< QString("file:" + testDataDir + "/rfc3252.txt")
QNetworkRequest request(url);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
// workaround for HTTPS requests: add self-signed server cert to list of CA certs,
// since we cannot react to the sslErrors() signal
// to fix this properly we would need to have an ignoreSslErrors() method in the
reply->deleteLater();
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QNetworkReply::synchronousRequestSslFailure()
{
// test that SSL won't be accepted with self-signed certificate,
#include <QStringList>
#include <QTcpServer>
#include <QTcpSocket>
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
#include <QSslSocket>
#endif
#include <QTextStream>
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false;
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QTest::newRow("WithoutProxy SSL") << false << 0 << true;
QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true;
QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true;
QTcpSocket *tst_QTcpSocket::newSocket() const
{
QTcpSocket *socket;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QFETCH_GLOBAL(bool, ssl);
socket = ssl ? new QSslSocket : new QTcpSocket;
#else
protected:
inline void run()
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QFETCH_GLOBAL(bool, ssl);
if (ssl)
socket = new QSslSocket;
attemptedToConnect = false;
networkTimeout = false;
count = 0;
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QFETCH_GLOBAL(bool, ssl);
if (ssl)
sock = new QSslSocket;
QMap<QString, QString> sha1Map;
void createTestRows();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void compareCertificates(const QSslCertificate & cert1, const QSslCertificate & cert2);
#endif
void initTestCase();
void cleanupTestCase();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
private slots:
void emptyConstructor();
void constructor_data();
return file.readAll();
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QSslCertificate::emptyConstructor()
{
}
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslCertificate)
#include "tst_qsslcertificate.moc"
void init();
void cleanup();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
private slots:
void constructing();
{
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QSslCipher::constructing()
{
QSslCipher cipher;
}
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslCipher)
#include "tst_qsslcipher.moc"
void init();
void cleanup();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
private slots:
void constructing();
#endif
{
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QSslError::constructing()
{
QSslError error;
}
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslError)
#include "tst_qsslerror.moc"
public slots:
void initTestCase();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
private slots:
void emptyConstructor();
return file.readAll();
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QSslKey::emptyConstructor()
{
#include <QAuthenticator>
#include "private/qhostinfo_p.h"
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
#include "private/qsslsocket_openssl_p.h"
#include "private/qsslsocket_openssl_symbols_p.h"
#include "private/qsslconfiguration_p.h"
Q_DECLARE_METATYPE(QAbstractSocket::SocketState)
Q_DECLARE_METATYPE(QAbstractSocket::SocketError)
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
Q_DECLARE_METATYPE(QSslSocket::SslMode)
typedef QList<QSslError::SslError> SslErrorList;
Q_DECLARE_METATYPE(SslErrorList)
#define QSSLSOCKET_CERTUNTRUSTED_WORKAROUND
#endif
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
class QSslSocketPtr: public QSharedPointer<QSslSocket>
{
public:
return QTestEventLoop::instance().timeout();
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocketPtr newSocket();
#endif
void cleanup();
void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth);
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
private slots:
void constructing();
void simpleConnect();
private:
QSslSocket *socket;
QList<QSslError> storedExpectedSslErrors;
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
private:
static int loopLevel;
};
tst_QSslSocket::tst_QSslSocket()
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
qRegisterMetaType<QList<QSslError> >("QList<QSslError>");
qRegisterMetaType<QSslError>("QSslError");
qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState");
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocketPtr tst_QSslSocket::newSocket()
{
QSslSocket *socket = new QSslSocket;
auth->setPassword("password");
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_QSslSocket::constructing()
{
QVERIFY2(!socket->waitForEncrypted(4000), qPrintable(socket->errorString()));
}
-#endif // QT_NO_OPENSSL
+#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslSocket)
void httpServerFiles();
void httpServerCGI_data();
void httpServerCGI();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void httpsServer();
#endif
void httpProxy();
static bool doSocketFlush(QTcpSocket *socket, int timeout = 4000)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
#endif
QTime timer;
timer.start();
forever {
if (socket->bytesToWrite() == 0
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
&& sslSocket->encryptedBytesToWrite() == 0
#endif
)
static void netChat(int port, const QList<Chat> &chat)
{
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QSslSocket socket;
#else
QTcpSocket socket;
break;
case Chat::StartEncryption:
-#ifdef QT_NO_OPENSSL
+#ifdef QT_NO_SSL
QFAIL("Internal error: SSL required for this test");
#else
qDebug() << i << "Starting client encryption";
netChat(80, chat);
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_NetworkSelfTest::httpsServer()
{
netChat(443, QList<Chat>()
void tst_NetworkSelfTest::supportsSsl()
{
-#ifdef QT_NO_OPENSSL
+#ifdef QT_NO_SSL
QFAIL("SSL not compiled in");
#else
QVERIFY2(QSslSocket::supportsSsl(), "Could not load SSL libraries");
void initTestCase();
void httpLatency();
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void echoPerformance_data();
void echoPerformance();
#endif
}
}
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
void tst_qnetworkreply::echoPerformance_data()
{
QTest::addColumn<bool>("ssl");
QTest::addColumn<QUrl>("url");
QTest::newRow("HTTP") << QUrl("http://" + QtNetworkSettings::serverName() + "/mediumfile");
-#ifndef QT_NO_OPENSSL
+#ifndef QT_NO_SSL
QTest::newRow("HTTP+SSL") << QUrl("https://" + QtNetworkSettings::serverName() + "/mediumfile");
#endif