Mercurial > trustbridge
comparison ui/sslconnection_curl.h @ 908:d1c951b3012d
Curl based implementation of sslconnection
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 13 Aug 2014 19:35:08 +0200 |
parents | |
children | eaed02defe6a |
comparison
equal
deleted
inserted
replaced
907:7bd75417e14e | 908:d1c951b3012d |
---|---|
1 #ifndef UI_SSLCONNECTION_CURL_H | |
2 #define UI_SSLCONNECTION_CURL_H | |
3 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik | |
4 * Software engineering by Intevation GmbH | |
5 * | |
6 * This file is Free Software under the GNU GPL (v>=2) | |
7 * and comes with ABSOLUTELY NO WARRANTY! | |
8 * See LICENSE.txt for details. | |
9 */ | |
10 | |
11 #include "sslconnection.h" | |
12 #include <curl/curl.h> | |
13 | |
14 #include <QTemporaryFile> | |
15 | |
16 class SSLConnectionCurl : public SSLConnection | |
17 { | |
18 public: | |
19 SSLConnectionCurl(const QString& url, | |
20 const QByteArray& certificate = QByteArray()); | |
21 | |
22 ~SSLConnectionCurl(); | |
23 | |
24 /** @brief write */ | |
25 int write(const QByteArray& request); | |
26 | |
27 /** | |
28 * @brief read at most len bytes and reset the connection | |
29 * | |
30 * @param [in] len Amount of bytes to read. | |
31 * | |
32 * @returns a byte array containing the data or | |
33 * a NULL byte array on error*/ | |
34 QByteArray read(size_t len); | |
35 | |
36 /** @brief: Establish the connection | |
37 * | |
38 * @returns 0 on success otherwise an error or -1 is returned | |
39 */ | |
40 int connect(); | |
41 private: | |
42 CURL *mCurl; | |
43 QTemporaryFile mCertFile; | |
44 }; | |
45 | |
46 /** | |
47 * @file sslconnection_curl.h | |
48 * @brief SSLConnection utilizing libcurl for http. | |
49 */ | |
50 #endif // UI_SSLCONNECTION_CURL_H |