hyperion.ng/libsrc/webserver/StaticFileServing.h

47 lines
1.0 KiB
C
Raw Normal View History

#ifndef STATICFILESERVING_H
#define STATICFILESERVING_H
#include <QMimeDatabase>
2018-12-30 22:07:53 +01:00
//#include "QtHttpServer.h"
#include "QtHttpRequest.h"
#include "QtHttpReply.h"
#include "QtHttpHeader.h"
2018-12-30 22:07:53 +01:00
#include "CgiHandler.h"
#include <utils/Logger.h>
class StaticFileServing : public QObject
{
Q_OBJECT
public:
explicit StaticFileServing (QObject * parent = nullptr);
~StaticFileServing() override;
2018-12-30 22:07:53 +01:00
///
/// @brief Overwrite current base url
///
2018-12-27 23:11:32 +01:00
void setBaseUrl(const QString& url);
2018-12-30 22:07:53 +01:00
///
/// @brief Set a new SSDP description, if empty the description will be unset and clients will get a NotFound
/// @param The description
///
void setSSDPDescription(const QString& desc);
2018-12-27 23:11:32 +01:00
public slots:
void onRequestNeedsReply (QtHttpRequest * request, QtHttpReply * reply);
private:
QString _baseUrl;
QMimeDatabase * _mimeDb;
CgiHandler _cgi;
Logger * _log;
2018-12-30 22:07:53 +01:00
QByteArray _ssdpDescription;
void printErrorToReply (QtHttpReply * reply, QtHttpReply::StatusCode code, QString errorMessage);
};
#endif // STATICFILESERVING_H