1 #ifndef GEMINICLIENT_HPP 2 #define GEMINICLIENT_HPP 3 4 #include <QObject> 5 #include <QMimeType> 6 #include <QSslSocket> 7 #include <QUrl> 8 9 #include "protocolhandler.hpp" 10 11 class GeminiClient : public ProtocolHandler 12 { 13 private: 14 Q_OBJECT 15 public: 16 explicit GeminiClient(); 17 18 ~GeminiClient() override; 19 20 bool supportsScheme(QString const & scheme) const override; 21 22 bool startRequest(QUrl const & url, RequestOptions options) override; 23 24 bool isInProgress() const override; 25 26 bool cancelRequest() override; 27 28 bool enableClientCertificate(CryptoIdentity const & ident) override; 29 void disableClientCertificate() override; 30 31 private slots: 32 void socketEncrypted(); 33 34 void socketReadyRead(); 35 36 void socketDisconnected(); 37 38 void sslErrors(const QList<QSslError> &errors); 39 40 void socketError(QAbstractSocket::SocketError socketError); 41 42 private: 43 bool is_receiving_body; 44 bool suppress_socket_tls_error; 45 bool is_error_state; 46 47 QUrl target_url; 48 QSslSocket socket; 49 QByteArray buffer; 50 QByteArray body; 51 QString mime_type; 52 RequestOptions options; 53 }; 54 55 #endif // GEMINICLIENT_HPP 56