1 #ifndef WEBCLIENT_HPP 2 #define WEBCLIENT_HPP 3 4 #include <QObject> 5 #include <QNetworkAccessManager> 6 #include <QNetworkReply> 7 8 #include "protocolhandler.hpp" 9 10 class WebClient: public ProtocolHandler 11 { 12 private: 13 Q_OBJECT 14 public: 15 explicit WebClient(); 16 17 ~WebClient() override; 18 19 bool supportsScheme(QString const & scheme) const override; 20 21 bool startRequest(QUrl const & url, RequestOptions options) override; 22 23 bool isInProgress() const override; 24 25 bool cancelRequest() override; 26 27 bool enableClientCertificate(CryptoIdentity const & ident) override; 28 void disableClientCertificate() override; 29 30 private slots: 31 void on_data(); 32 void on_finished(); 33 void on_sslErrors(const QList<QSslError> &errors); 34 void on_redirected(const QUrl &url); 35 36 private: 37 QNetworkAccessManager manager; 38 QNetworkReply * current_reply; 39 40 QByteArray body; 41 RequestOptions options; 42 43 CryptoIdentity current_identity; 44 45 bool suppress_socket_tls_error; 46 }; 47 48 #endif // WEBCLIENT_HPP 49