Mercurial > trustbridge
annotate ui/sslconnection_curl.h @ 1369:948f03bb5254
Add signature time extraction for Linux and test for it in binverifytest
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 24 Nov 2014 14:43:10 +0100 |
parents | 2a1aa9df8f11 |
children |
rev | line source |
---|---|
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 #ifndef UI_SSLCONNECTION_CURL_H |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 #define UI_SSLCONNECTION_CURL_H |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 * Software engineering by Intevation GmbH |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 * |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 * This file is Free Software under the GNU GPL (v>=2) |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 * and comes with ABSOLUTELY NO WARRANTY! |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 * See LICENSE.txt for details. |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 */ |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
11 /** |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
12 * @file sslconnection_curl.h |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
13 * @brief SSLConnection utilizing libcurl for http. |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
14 */ |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
15 |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 #include "sslconnection.h" |
956
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
910
diff
changeset
|
17 |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 #include <curl/curl.h> |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
20 #include <QDateTime> |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 #include <QTemporaryFile> |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
23 class QSaveFile; |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
24 |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
991
diff
changeset
|
25 /** @brief SSLConnection implementation using LibCURL |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
991
diff
changeset
|
26 * |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
991
diff
changeset
|
27 * This class uses a modified version of the curl library to |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
991
diff
changeset
|
28 * speak the HTTP with the downloader server. Provides |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
991
diff
changeset
|
29 * Proxy support. |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
991
diff
changeset
|
30 */ |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 class SSLConnectionCurl : public SSLConnection |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 { |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 public: |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 SSLConnectionCurl(const QString& url, |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 const QByteArray& certificate = QByteArray()); |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 ~SSLConnectionCurl(); |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
39 int connect(); |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
41 QDateTime getLastModifiedHeader(const QString &resource); |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
43 bool downloadFile(const QString &resource, const QString &filename, |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
44 size_t maxSize); |
956
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
910
diff
changeset
|
45 |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
910
diff
changeset
|
46 void setProxy(const QUrl &proxyUrl); |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
910
diff
changeset
|
47 |
991
6a3d284b9c16
Delegate certificate loading to base class. Minor cleanups.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
48 void setCiphersuites(int ciphers[]); |
6a3d284b9c16
Delegate certificate loading to base class. Minor cleanups.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
49 |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 private: |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 CURL *mCurl; |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 QTemporaryFile mCertFile; |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
53 char mErrBuf[CURL_ERROR_SIZE + 1]; |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
54 |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
55 }; |
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 |
991
6a3d284b9c16
Delegate certificate loading to base class. Minor cleanups.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
57 /** @brief Internal write function for curl */ |
910
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
58 size_t write_data(void *ptr, size_t size, size_t nmemb, QSaveFile *fp); |
eaed02defe6a
More SSLConnection refactoring. Fixes curl downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
908
diff
changeset
|
59 |
908
d1c951b3012d
Curl based implementation of sslconnection
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 #endif // UI_SSLCONNECTION_CURL_H |