2016-06-12 22:27:24 +02:00
|
|
|
#ifndef QTHTTPREQUEST_H
|
|
|
|
#define QTHTTPREQUEST_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QHash>
|
|
|
|
#include <QUrl>
|
2016-06-19 00:56:47 +02:00
|
|
|
#include <QHostAddress>
|
2016-06-12 22:27:24 +02:00
|
|
|
|
|
|
|
class QtHttpServer;
|
|
|
|
|
|
|
|
class QtHttpRequest : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit QtHttpRequest (QtHttpServer * parent);
|
|
|
|
|
2016-06-19 00:56:47 +02:00
|
|
|
struct ClientInfo {
|
|
|
|
QHostAddress serverAddress;
|
|
|
|
QHostAddress clientAddress;
|
|
|
|
};
|
|
|
|
|
|
|
|
int getRawDataSize (void) const;
|
2016-06-12 22:27:24 +02:00
|
|
|
QUrl getUrl (void) const;
|
|
|
|
QString getCommand (void) const;
|
|
|
|
QByteArray getRawData (void) const;
|
|
|
|
QList<QByteArray> getHeadersList (void) const;
|
2016-06-19 00:56:47 +02:00
|
|
|
ClientInfo getClientInfo (void) const;
|
2016-06-12 22:27:24 +02:00
|
|
|
|
|
|
|
QByteArray getHeader (const QByteArray & header) const;
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void setUrl (const QUrl & url);
|
|
|
|
void setCommand (const QString & command);
|
2016-06-19 00:56:47 +02:00
|
|
|
void setClientInfo (const QHostAddress & server, const QHostAddress & client);
|
2016-06-12 22:27:24 +02:00
|
|
|
void addHeader (const QByteArray & header, const QByteArray & value);
|
|
|
|
void appendRawData (const QByteArray & data);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QUrl m_url;
|
|
|
|
QString m_command;
|
|
|
|
QByteArray m_data;
|
|
|
|
QtHttpServer * m_serverHandle;
|
|
|
|
QHash<QByteArray, QByteArray> m_headersHash;
|
2016-06-19 00:56:47 +02:00
|
|
|
ClientInfo m_clientInfo;
|
2016-06-12 22:27:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QTHTTPREQUEST_H
|