blob: 888ebd89ab6f8e151830190a7b9cf80b39383735 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef GOPHERCLIENT_HPP
#define GOPHERCLIENT_HPP
#include <QObject>
#include <QTcpSocket>
#include <QUrl>
#include "protocolhandler.hpp"
class GopherClient : public ProtocolHandler
{
Q_OBJECT
public:
explicit GopherClient(QObject *parent = nullptr);
~GopherClient() override;
bool supportsScheme(QString const & scheme) const override;
bool startRequest(QUrl const & url, RequestOptions options) override;
bool isInProgress() const override;
bool cancelRequest() override;
private: // slots
void on_connected();
void on_readRead();
void on_finished();
void on_socketError(QAbstractSocket::SocketError errorCode);
private:
QTcpSocket socket;
QByteArray body;
QUrl requested_url;
bool was_cancelled;
QString mime;
bool is_processing_binary;
};
#endif // GOPHERCLIENT_HPP
|