MythTV master
mythhttprewrite.cpp
Go to the documentation of this file.
1// MythTV
2#include "mythdirs.h"
3#include "mythlogging.h"
5#include "http/mythhttpdata.h"
6#include "http/mythhttpfile.h"
9
10
23{
24 auto result = static_cast<HTTPResponse>(nullptr);
25 if (!Request)
26 return result;
27
28 LOG(VB_HTTP, LOG_INFO, QString("Rewriting request to new file '%1'").arg(File));
29 if (!File.isEmpty())
30 {
31 Request->m_fileName = File;
33 }
34 return result;
35
36}
37
51{
52 auto result = static_cast<HTTPResponse>(nullptr);
53 if (!Request)
54 return result;
55
56 LOG(VB_HTTP, LOG_INFO, QString("Rewriting request to web app '%1'").arg(File));
57 if (!File.isEmpty()
58 && (Request->m_path.isEmpty() || Request->m_path == "/"
59 || Request->m_path == "/dashboard/" || Request->m_path == "/setupwizard/"
60 || Request->m_path == "/MythFE/"))
61 {
62 Request->m_fileName = File;
63 Request->m_status = HTTPOK;
64 Request->m_path = "/";
66 }
67 return result;
68
69}
static HTTPResponse ProcessFile(const HTTPRequest2 &Request)
static HTTPResponse RewriteFile(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests for files to a context specific file.
static HTTPResponse RewriteToSPA(const HTTPRequest2 &Request, const QString &File)
A convenience method to seemlessly redirect requests to a Single Page web app (SPA)
@ HTTPOK
std::shared_ptr< MythHTTPRequest > HTTPRequest2
Definition: mythhttptypes.h:39
std::shared_ptr< MythHTTPResponse > HTTPResponse
Definition: mythhttptypes.h:40
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39