181 void ignoreSslErrorsList(); |
181 void ignoreSslErrorsList(); |
182 void ignoreSslErrorsListWithSlot_data(); |
182 void ignoreSslErrorsListWithSlot_data(); |
183 void ignoreSslErrorsListWithSlot(); |
183 void ignoreSslErrorsListWithSlot(); |
184 void readFromClosedSocket(); |
184 void readFromClosedSocket(); |
185 void writeBigChunk(); |
185 void writeBigChunk(); |
|
186 void setEmptyDefaultConfiguration(); |
186 |
187 |
187 static void exitLoop() |
188 static void exitLoop() |
188 { |
189 { |
189 // Safe exit - if we aren't in an event loop, don't |
190 // Safe exit - if we aren't in an event loop, don't |
190 // exit one. |
191 // exit one. |
1070 // Passing CN matches |
1071 // Passing CN matches |
1071 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("www.example.com"), QString("www.example.com")), true ); |
1072 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("www.example.com"), QString("www.example.com")), true ); |
1072 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("www.example.com")), true ); |
1073 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example.com"), QString("www.example.com")), true ); |
1073 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx*.example.com"), QString("xxxwww.example.com")), true ); |
1074 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx*.example.com"), QString("xxxwww.example.com")), true ); |
1074 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("foo.example.com")), true ); |
1075 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("f*.example.com"), QString("foo.example.com")), true ); |
|
1076 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("192.168.0.0"), QString("192.168.0.0")), true ); |
1075 |
1077 |
1076 // Failing CN matches |
1078 // Failing CN matches |
1077 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx.example.com"), QString("www.example.com")), false ); |
1079 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("xxx.example.com"), QString("www.example.com")), false ); |
1078 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www.example.com")), false ); |
1080 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www.example.com")), false ); |
1079 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.*.com"), QString("www.example.com")), false ); |
1081 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.*.com"), QString("www.example.com")), false ); |
1083 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*fail.com"), QString("example.com")), false ); |
1085 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*fail.com"), QString("example.com")), false ); |
1084 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example.")), false ); |
1086 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example.")), false ); |
1085 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example")), false ); |
1087 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.example."), QString("www.example")), false ); |
1086 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString(""), QString("www")), false ); |
1088 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString(""), QString("www")), false ); |
1087 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www")), false ); |
1089 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*"), QString("www")), false ); |
|
1090 QCOMPARE( QSslSocketBackendPrivate::isMatchingHostname(QString("*.168.0.0"), QString("192.168.0.0")), false ); |
1088 } |
1091 } |
1089 |
1092 |
1090 void tst_QSslSocket::wildcard() |
1093 void tst_QSslSocket::wildcard() |
1091 { |
1094 { |
1092 QSKIP("TODO: solve wildcard problem", SkipAll); |
1095 QSKIP("TODO: solve wildcard problem", SkipAll); |
1831 QVERIFY(socket->bytesToWrite() == 0); |
1834 QVERIFY(socket->bytesToWrite() == 0); |
1832 |
1835 |
1833 socket->close(); |
1836 socket->close(); |
1834 } |
1837 } |
1835 |
1838 |
|
1839 void tst_QSslSocket::setEmptyDefaultConfiguration() |
|
1840 { |
|
1841 // used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265 |
|
1842 |
|
1843 if (!QSslSocket::supportsSsl()) |
|
1844 return; |
|
1845 |
|
1846 QSslConfiguration emptyConf; |
|
1847 QSslConfiguration::setDefaultConfiguration(emptyConf); |
|
1848 |
|
1849 QSslSocketPtr socket = newSocket(); |
|
1850 socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); |
|
1851 |
|
1852 } |
|
1853 |
1836 #endif // QT_NO_OPENSSL |
1854 #endif // QT_NO_OPENSSL |
1837 |
1855 |
1838 QTEST_MAIN(tst_QSslSocket) |
1856 QTEST_MAIN(tst_QSslSocket) |
1839 #include "tst_qsslsocket.moc" |
1857 #include "tst_qsslsocket.moc" |