Changeset View
Changeset View
Standalone View
Standalone View
src/core/ktcpsocket.cpp
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | |||||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | //cipher class converter KSslCipher -> QSslCipher | 130 | //cipher class converter KSslCipher -> QSslCipher | ||
131 | class CipherCc | 131 | class CipherCc | ||
132 | { | 132 | { | ||
133 | public: | 133 | public: | ||
134 | CipherCc() | 134 | CipherCc() | ||
135 | { | 135 | { | ||
136 | foreach (const QSslCipher &c, QSslConfiguration::supportedCiphers()) { | 136 | const QList<QSslCipher> list = QSslConfiguration::supportedCiphers(); | ||
137 | for (const QSslCipher &c : list) { | ||||
137 | allCiphers.insert(c.name(), c); | 138 | allCiphers.insert(c.name(), c); | ||
138 | } | 139 | } | ||
139 | } | 140 | } | ||
140 | 141 | | |||
141 | QSslCipher converted(const KSslCipher &ksc) | 142 | QSslCipher converted(const KSslCipher &ksc) | ||
142 | { | 143 | { | ||
143 | return allCiphers.value(ksc.name()); | 144 | return allCiphers.value(ksc.name()); | ||
144 | } | 145 | } | ||
▲ Show 20 Lines • Show All 575 Lines • ▼ Show 20 Line(s) | 717 | { | |||
720 | d->certificatesLoaded = true; | 721 | d->certificatesLoaded = true; | ||
721 | } | 722 | } | ||
722 | 723 | | |||
723 | void KTcpSocket::setCiphers(const QList<KSslCipher> &ciphers) | 724 | void KTcpSocket::setCiphers(const QList<KSslCipher> &ciphers) | ||
724 | { | 725 | { | ||
725 | d->ciphers = ciphers; | 726 | d->ciphers = ciphers; | ||
726 | QList<QSslCipher> cl; | 727 | QList<QSslCipher> cl; | ||
727 | cl.reserve(d->ciphers.size()); | 728 | cl.reserve(d->ciphers.size()); | ||
728 | foreach (const KSslCipher &c, d->ciphers) { | 729 | for (const KSslCipher &c : ciphers) { | ||
dfaure: or just iterate over `ciphers`, which is already const | |||||
ahmadsamir: Yep. | |||||
729 | cl.append(d->ccc.converted(c)); | 730 | cl.append(d->ccc.converted(c)); | ||
730 | } | 731 | } | ||
731 | QSslConfiguration configuration = d->sock.sslConfiguration(); | 732 | QSslConfiguration configuration = d->sock.sslConfiguration(); | ||
732 | configuration.setCiphers(cl); | 733 | configuration.setCiphers(cl); | ||
733 | d->sock.setSslConfiguration(configuration); | 734 | d->sock.setSslConfiguration(configuration); | ||
734 | } | 735 | } | ||
735 | 736 | | |||
736 | void KTcpSocket::setLocalCertificate(const QSslCertificate &certificate) | 737 | void KTcpSocket::setLocalCertificate(const QSslCertificate &certificate) | ||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 819 | { | |||
819 | d->maybeLoadCertificates(); | 820 | d->maybeLoadCertificates(); | ||
820 | d->sock.setProtocol(qSslProtocolFromK(d->advertisedSslVersion)); | 821 | d->sock.setProtocol(qSslProtocolFromK(d->advertisedSslVersion)); | ||
821 | d->sock.startClientEncryption(); | 822 | d->sock.startClientEncryption(); | ||
822 | } | 823 | } | ||
823 | 824 | | |||
824 | //debugging H4X | 825 | //debugging H4X | ||
825 | void KTcpSocket::showSslErrors() | 826 | void KTcpSocket::showSslErrors() | ||
826 | { | 827 | { | ||
827 | foreach (const QSslError &e, d->sock.sslErrors()) { | 828 | const QList<QSslError> list = d->sock.sslErrors(); | ||
829 | for (const QSslError &e : list) { | ||||
828 | qCDebug(KIO_CORE) << e.errorString(); | 830 | qCDebug(KIO_CORE) << e.errorString(); | ||
829 | } | 831 | } | ||
830 | } | 832 | } | ||
831 | 833 | | |||
832 | void KTcpSocket::setAdvertisedSslVersion(KTcpSocket::SslVersion version) | 834 | void KTcpSocket::setAdvertisedSslVersion(KTcpSocket::SslVersion version) | ||
833 | { | 835 | { | ||
834 | d->advertisedSslVersion = version; | 836 | d->advertisedSslVersion = version; | ||
835 | } | 837 | } | ||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |
or just iterate over ciphers, which is already const