andre@908: #ifndef UI_SSLCONNECTION_CURL_H andre@908: #define UI_SSLCONNECTION_CURL_H andre@908: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik andre@908: * Software engineering by Intevation GmbH andre@908: * andre@908: * This file is Free Software under the GNU GPL (v>=2) andre@908: * and comes with ABSOLUTELY NO WARRANTY! andre@908: * See LICENSE.txt for details. andre@908: */ andre@908: andre@910: /** andre@910: * @file sslconnection_curl.h andre@910: * @brief SSLConnection utilizing libcurl for http. andre@910: */ andre@910: andre@908: #include "sslconnection.h" andre@956: andre@908: #include andre@908: andre@910: #include andre@908: #include andre@908: andre@910: class QSaveFile; andre@910: andre@1255: /** @brief SSLConnection implementation using LibCURL andre@1255: * andre@1255: * This class uses a modified version of the curl library to andre@1255: * speak the HTTP with the downloader server. Provides andre@1255: * Proxy support. andre@1255: */ andre@908: class SSLConnectionCurl : public SSLConnection andre@908: { andre@908: public: andre@908: SSLConnectionCurl(const QString& url, andre@908: const QByteArray& certificate = QByteArray()); andre@908: andre@908: ~SSLConnectionCurl(); andre@908: andre@910: int connect(); andre@908: andre@910: QDateTime getLastModifiedHeader(const QString &resource); andre@908: andre@910: bool downloadFile(const QString &resource, const QString &filename, andre@910: size_t maxSize); andre@956: andre@956: void setProxy(const QUrl &proxyUrl); andre@956: andre@991: void setCiphersuites(int ciphers[]); andre@991: andre@908: private: andre@908: CURL *mCurl; andre@908: QTemporaryFile mCertFile; andre@910: char mErrBuf[CURL_ERROR_SIZE + 1]; andre@910: andre@908: }; andre@908: andre@991: /** @brief Internal write function for curl */ andre@910: size_t write_data(void *ptr, size_t size, size_t nmemb, QSaveFile *fp); andre@910: andre@908: #endif // UI_SSLCONNECTION_CURL_H