1 /*
2  * \brief Sends one time GET requests to server.
3  *
4  * \copyright Copyright (c) 2014-2021 Governikus GmbH & Co. KG, Germany
5  */
6 
7 #pragma once
8 
9 #include <QEventLoop>
10 #include <QHostAddress>
11 #include <QNetworkReply>
12 #include <QSharedPointer>
13 #include <QTimer>
14 
15 namespace governikus
16 {
17 
18 class HttpServerRequestor
19 	: public QObject
20 {
21 	Q_OBJECT
22 
23 	private:
24 		QEventLoop mEventLoop;
25 		QTimer mTimer;
26 
27 	public:
28 		HttpServerRequestor();
29 		~HttpServerRequestor() override;
30 
31 		QSharedPointer<QNetworkReply> request(const QUrl& pUrl, int pTimeOut = 2000);
32 		static QUrl createUrl(const QString& pQuery, quint16 pPort, const QHostAddress& pHost = QHostAddress::LocalHost, const QString& pPath = QStringLiteral("/eID-Client"));
33 
34 	private Q_SLOTS:
35 		void finished();
36 };
37 
38 } // namespace governikus
39