12#define LOC QString("HTTPFile: ")
16 return std::shared_ptr<MythHTTPFile>(
new MythHTTPFile(ShortName, FullName));
46 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"Looking for '%1'").arg(
file));
50 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"Failed to find '%1'").arg(
file));
57 if (!httpfile->open(QIODevice::ReadOnly))
59 LOG(VB_GENERAL, LOG_WARNING,
LOC + QString(
"Failed to open '%1'").arg(
file));
65 static const std::vector<const char *> s_exts = {
".json",
".js",
".html",
".css" };
67 if (std::any_of(s_exts.cbegin(), s_exts.cend(),
68 [&](
const char * value) { return file.endsWith(value); }))
73 httpfile->m_lastModified = QFileInfo(
file).lastModified();
75 LOG(VB_HTTP, LOG_DEBUG,
LOC + QString(
"Last modified: %2")
80 QString mime = httpfile->m_mimeType.Name();
81 LOG(VB_HTTP, LOG_INFO,
LOC + QString(
"mimetype '%1'").arg(mime));
static HTTPFile Create(const QString &ShortName, const QString &FullName)
MythHTTPFile(const QString &ShortName, const QString &FullName)
Default constructor.
static HTTPResponse ProcessFile(const HTTPRequest2 &Request)
static HTTPResponse FileResponse(const HTTPRequest2 &Request, const HTTPFile &File)
static HTTPResponse HandleOptions(const HTTPRequest2 &Request)
static HTTPResponse ErrorResponse(MythHTTPStatus Status, const QString &ServerName)
std::shared_ptr< MythHTTPFile > HTTPFile
std::shared_ptr< MythHTTPRequest > HTTPRequest2
std::shared_ptr< MythHTTPResponse > HTTPResponse
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
@ kOverrideUTC
Present date/time in UTC.
@ kRFC822
HTTP Date format.