# HG changeset patch # User Andre Heinecke # Date 1409566039 -7200 # Node ID 6a3d284b9c16894fca1b234e6d813e475b4c6dc4 # Parent 2949f18429553f5894689cf5e9b26c4aa1ab0b3a Delegate certificate loading to base class. Minor cleanups. diff -r 2949f1842955 -r 6a3d284b9c16 ui/sslconnection_curl.cpp --- a/ui/sslconnection_curl.cpp Mon Sep 01 12:04:11 2014 +0200 +++ b/ui/sslconnection_curl.cpp Mon Sep 01 12:07:19 2014 +0200 @@ -16,25 +16,6 @@ SSLConnection (url, certificate), mCurl (NULL) { - if (certificate.isEmpty()) { - /* Security: curl does not support leaf certificate pinning. So - * while the bare connection pins the certificate directly the - * curl implementation pins the issuer of the peer certificate - * - * CURLINFO_TLS_SESSION is also not implmented for polarssl - * so there is no way to obtain / verify peer certificate manually - * at this point. - **/ -#ifdef RELEASE_BUILD -#error "Curl release build is not supported at this moment." -#else - QFile certResource(":certs/geotrust"); -#endif - certResource.open(QFile::ReadOnly); - mPinnedCert = certResource.readAll(); - certResource.close(); - } - curl_global_init(CURL_GLOBAL_DEFAULT); mCurl = curl_easy_init(); @@ -66,6 +47,7 @@ qDebug() << "Failed to write temporary certificate"; return; } + mInitialized = true; #ifdef CONNECTION_DEBUG @@ -110,7 +92,7 @@ return 0; } -/* Globally do this as we can't pass this to the c function */ +/* Globally do this as we can't pass "this" (the ptr) to the c function */ size_t ssl_curl_max_write, ssl_curl_written; size_t write_data(void *ptr, size_t size, size_t nmemb, @@ -135,9 +117,9 @@ const QString &fileName, size_t maxSize) { - QSaveFile outputFile(fileName); ssl_curl_written = 0; ssl_curl_max_write = maxSize; + QSaveFile outputFile(fileName); // Open / Create the file to write to. if (!outputFile.open(QIODevice::WriteOnly)) { qDebug() << "Failed to open file"; @@ -241,5 +223,8 @@ qDebug() << "Failed to set proxy"; return; } - qDebug() << "Set proxy to: " << proxyUrl; } + +void SSLConnectionCurl::setCiphersuites(int ciphers[]) { + qDebug() << "Set ciphersuites not supported."; +} diff -r 2949f1842955 -r 6a3d284b9c16 ui/sslconnection_curl.h --- a/ui/sslconnection_curl.h Mon Sep 01 12:04:11 2014 +0200 +++ b/ui/sslconnection_curl.h Mon Sep 01 12:07:19 2014 +0200 @@ -39,14 +39,16 @@ void setProxy(const QUrl &proxyUrl); + void setCiphersuites(int ciphers[]); + private: CURL *mCurl; QTemporaryFile mCertFile; char mErrBuf[CURL_ERROR_SIZE + 1]; - /** @brief Internal write function for curl */ }; +/** @brief Internal write function for curl */ size_t write_data(void *ptr, size_t size, size_t nmemb, QSaveFile *fp); #endif // UI_SSLCONNECTION_CURL_H