|
MythTV master
|
#include <libmythupnp/httprequest.h>
Public Member Functions | |
| HTTPRequest () | |
| virtual | ~HTTPRequest ()=default |
| bool | ParseRequest () |
| void | FormatErrorResponse (bool bServerError, const QString &sFaultString, const QString &sDetails) |
| void | FormatErrorResponse (UPnPResultCode eCode, const QString &sMsg="") |
| void | FormatActionResponse (Serializer *ser) |
| void | FormatActionResponse (const NameValues &pArgs) |
| void | FormatFileResponse (const QString &sFileName) |
| void | FormatRawResponse (const QString &sXML) |
| qint64 | SendResponse (void) |
| void | SendResponseRedirect (const QString &hostName) |
| qint64 | SendResponseFile (const QString &sFileName) |
| void | SetResponseHeader (const QString &sKey, const QString &sValue, bool replace=false) |
| void | SetCookie (const QString &sKey, const QString &sValue, const QDateTime &expiryDate, bool secure) |
| QString | GetRequestHeader (const QString &sKey, const QString &sDefault) |
| bool | GetKeepAlive () const |
| Serializer * | GetSerializer () |
| QByteArray | GetResponsePage (void) |
| QString | GetRequestProtocol () const |
| QString | GetRequestType () const |
| QString | GetLastHeader (const QString &sType) const |
| void | SetKeepAliveTimeout (std::chrono::seconds nTimeout) |
| virtual QString | ReadLine (std::chrono::milliseconds msecs)=0 |
| virtual qint64 | ReadBlock (char *pData, qint64 nMaxLen, std::chrono::milliseconds msecs=0ms)=0 |
| virtual qint64 | WriteBlock (const char *pData, qint64 nLen)=0 |
| virtual QString | GetHostName () |
| virtual QString | GetHostAddress ()=0 |
| virtual quint16 | GetHostPort ()=0 |
| virtual QString | GetPeerAddress ()=0 |
| virtual int | getSocketHandle ()=0 |
Static Public Member Functions | |
| static QString | GetResponseProtocol () |
| static QString | GetMimeType (const QString &sFileExtension) |
| static QStringList | GetSupportedMimeTypes () |
| static QString | TestMimeType (const QString &sFileName) |
| static long | GetParameters (QString sParams, QStringMap &mapParams) |
| static QString | GetETagHash (const QByteArray &data) |
Public Attributes | |
| HttpRequestType | m_eType {RequestTypeUnknown} |
| HttpContentType | m_eContentType {ContentType_Unknown} |
| QString | m_sRawRequest |
| QString | m_sOriginalUrl |
| QString | m_sRequestUrl |
| QString | m_sBaseUrl |
| QString | m_sResourceUrl |
| QString | m_sMethod |
| QStringMap | m_mapParams |
| QStringMultiMap | m_mapHeaders |
| QStringMap | m_mapCookies |
| QString | m_sPayload |
| QString | m_sProtocol |
| int | m_nMajor {0} |
| int | m_nMinor {0} |
| bool | m_bEncrypted {false} |
| bool | m_bSOAPRequest {false} |
| QString | m_sNameSpace |
| HttpResponseType | m_eResponseType {ResponseTypeUnknown} |
| QString | m_sResponseTypeText |
| long | m_nResponseStatus {200} |
| QStringMap | m_mapRespHeaders |
| QString | m_sFileName |
| QBuffer | m_response |
| IPostProcess * | m_pPostProcess {nullptr} |
| QString | m_sPrivateToken |
| MythUserSession | m_userSession |
Protected Member Functions | |
| HttpRequestType | SetRequestType (const QString &sType) |
| void | SetRequestProtocol (const QString &sLine) |
| HttpContentType | SetContentType (const QString &sType) |
| void | ProcessRequestLine (const QString &sLine) |
| bool | ProcessSOAPPayload (const QString &sSOAPAction) |
| void | ExtractMethodFromURL () |
| QString | GetResponseStatus (void) const |
| QString | GetResponseType (void) const |
| QString | GetResponseHeaders (void) |
| bool | ParseRange (QString sRange, long long llSize, long long *pllStart, long long *pllEnd) |
| bool | ParseKeepAlive (void) |
| void | ParseCookies (void) |
| QString | BuildResponseHeader (long long nSize) |
| qint64 | SendData (QIODevice *pDevice, qint64 llStart, qint64 llBytes) |
| qint64 | SendFile (QFile &file, qint64 llStart, qint64 llBytes) |
| bool | IsEncrypted () const |
| void | AddCORSHeaders (const QString &sOrigin) |
Protected Attributes | |
| QRegularExpression | m_procReqLineExp {"\\s+"} |
| QRegularExpression | m_parseRangeExp {"(\\d|\\-)"} |
Static Protected Attributes | |
| static const char * | s_szServerHeaders = "Accept-Ranges: bytes\r\n" |
Private Attributes | |
| bool | m_bKeepAlive {true} |
| std::chrono::seconds | m_nKeepAliveTimeout {0s} |
Definition at line 111 of file httprequest.h.
|
inline |
Definition at line 204 of file httprequest.h.
|
virtualdefault |
|
protected |
Definition at line 1966 of file httprequest.cpp.
Referenced by BuildResponseHeader().
|
protected |
Definition at line 257 of file httprequest.cpp.
Referenced by SendResponse(), and SendResponseFile().
|
protected |
Definition at line 1651 of file httprequest.cpp.
Referenced by ParseRequest().
| void HTTPRequest::FormatActionResponse | ( | const NameValues & | pArgs | ) |
Definition at line 822 of file httprequest.cpp.
| void HTTPRequest::FormatActionResponse | ( | Serializer * | ser | ) |
Definition at line 807 of file httprequest.cpp.
Referenced by ServiceHost::FormatResponse(), SSDPExtension::GetDeviceList(), InternetContent::GetInternetSources(), UPnpCDS::HandleBrowse(), UPnpCMGR::HandleGetCurrentConnectionIDs(), UPnpCMGR::HandleGetCurrentConnectionInfo(), UPnpCDS::HandleGetFeatureList(), UPnpCMGR::HandleGetFeatureList(), UPnpCMGR::HandleGetProtocolInfo(), UPnpCDS::HandleGetSearchCapabilities(), UPnpCDS::HandleGetServiceResetToken(), UPnpCDS::HandleGetSortCapabilities(), UPnpCDS::HandleGetSystemUpdateID(), UPnpMSRR::HandleIsAuthorized(), UPnpMSRR::HandleIsValidated(), UPnpMSRR::HandleRegisterDevice(), and UPnpCDS::HandleSearch().
| void HTTPRequest::FormatErrorResponse | ( | bool | bServerError, |
| const QString & | sFaultString, | ||
| const QString & | sDetails | ||
| ) |
Definition at line 744 of file httprequest.cpp.
Referenced by FormatErrorResponse(), UPnpCDS::HandleBrowse(), UPnpCMGR::HandleGetCurrentConnectionInfo(), UPnpCDS::HandleSearch(), Eventing::ProcessRequest(), UPnpCDS::ProcessRequest(), UPnpCMGR::ProcessRequest(), UPnpMSRR::ProcessRequest(), MythFEXML::ProcessRequest(), and ServiceHost::ProcessRequest().
| void HTTPRequest::FormatErrorResponse | ( | UPnPResultCode | eCode, |
| const QString & | sMsg = "" |
||
| ) |
Definition at line 780 of file httprequest.cpp.
| void HTTPRequest::FormatFileResponse | ( | const QString & | sFileName | ) |
Definition at line 899 of file httprequest.cpp.
Referenced by ServiceHost::FormatResponse(), UPnpCDS::ProcessRequest(), UPnpCMGR::ProcessRequest(), UPnpMSRR::ProcessRequest(), and MythFEXML::ProcessRequest().
| void HTTPRequest::FormatRawResponse | ( | const QString & | sXML | ) |
Definition at line 884 of file httprequest.cpp.
Referenced by InternetContent::GetInternetContent(), and InternetContent::GetInternetSearch().
|
static |
Definition at line 1835 of file httprequest.cpp.
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
Referenced by SSDPExtension::GetDeviceDesc(), and GetHostName().
|
virtual |
Definition at line 1900 of file httprequest.cpp.
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
|
inline |
Definition at line 233 of file httprequest.h.
Referenced by HttpWorker::run().
| QString HTTPRequest::GetLastHeader | ( | const QString & | sType | ) | const |
Definition at line 218 of file httprequest.cpp.
Referenced by GetHostName(), Wsdl::GetWSDL(), ParseRequest(), UPNPSubscription::ProcessRequest(), Xsd::RenderArrayXSD(), Xsd::RenderMapXSD(), Xsd::RenderXSD(), and SendResponseRedirect().
|
static |
Definition at line 1093 of file httprequest.cpp.
Referenced by UPnpCDSMusic::LoadTracks(), UPnpCDSVideo::LoadVideos(), and TestMimeType().
|
static |
Definition at line 1182 of file httprequest.cpp.
Referenced by ParseRequest(), and ProcessRequestLine().
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
Referenced by SendResponse().
| QString HTTPRequest::GetRequestHeader | ( | const QString & | sKey, |
| const QString & | sDefault | ||
| ) |
Definition at line 1221 of file httprequest.cpp.
Referenced by BuildResponseHeader(), UPnpCDS::DetermineClient(), FormatFileResponse(), SSDPExtension::GetDeviceDesc(), GetSerializer(), Eventing::HandleSubscribe(), Eventing::HandleUnsubscribe(), ParseKeepAlive(), ParseRequest(), SendResponse(), and SendResponseFile().
| QString HTTPRequest::GetRequestProtocol | ( | ) | const |
Definition at line 956 of file httprequest.cpp.
| QString HTTPRequest::GetRequestType | ( | ) | const |
Definition at line 1926 of file httprequest.cpp.
|
protected |
Definition at line 1236 of file httprequest.cpp.
Referenced by BuildResponseHeader().
| QByteArray HTTPRequest::GetResponsePage | ( | void | ) |
Definition at line 1064 of file httprequest.cpp.
Referenced by HttpServer::DelegateRequest(), FormatFileResponse(), SSDPExtension::GetFile(), ParseRequest(), HttpWorker::run(), and SendResponseFile().
|
static |
Definition at line 967 of file httprequest.cpp.
Referenced by BuildResponseHeader().
|
protected |
Definition at line 1010 of file httprequest.cpp.
Referenced by BuildResponseHeader(), GetResponsePage(), and SendResponse().
|
protected |
Definition at line 1073 of file httprequest.cpp.
Referenced by BuildResponseHeader().
| Serializer * HTTPRequest::GetSerializer | ( | ) |
Definition at line 1798 of file httprequest.cpp.
Referenced by ServiceHost::FormatResponse().
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
Referenced by ParseRange(), and ParseRequest().
|
static |
Definition at line 1112 of file httprequest.cpp.
Referenced by GetSinkProtocolInfos(), and GetSourceProtocolInfos().
|
inlineprotected |
Definition at line 198 of file httprequest.h.
Referenced by SetCookie().
|
protected |
Definition at line 1291 of file httprequest.cpp.
Referenced by ParseRequest().
|
protected |
Definition at line 1255 of file httprequest.cpp.
Referenced by ParseRequest().
|
protected |
Definition at line 1552 of file httprequest.cpp.
Referenced by SendResponseFile().
| bool HTTPRequest::ParseRequest | ( | ) |
Definition at line 1309 of file httprequest.cpp.
Referenced by HttpWorker::run().
|
protected |
Definition at line 1485 of file httprequest.cpp.
Referenced by ParseRequest().
|
protected |
Definition at line 1677 of file httprequest.cpp.
Referenced by ParseRequest().
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
Referenced by ParseRequest().
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
Referenced by ParseRequest().
|
protected |
Definition at line 682 of file httprequest.cpp.
Referenced by SendFile(), and SendResponse().
|
protected |
Definition at line 732 of file httprequest.cpp.
Referenced by SendResponseFile().
| qint64 HTTPRequest::SendResponse | ( | void | ) |
Definition at line 365 of file httprequest.cpp.
Referenced by HttpWorker::run(), and SendResponseRedirect().
| qint64 HTTPRequest::SendResponseFile | ( | const QString & | sFileName | ) |
Definition at line 537 of file httprequest.cpp.
Referenced by SendResponse().
| void HTTPRequest::SendResponseRedirect | ( | const QString & | hostName | ) |
Definition at line 513 of file httprequest.cpp.
Referenced by ServiceHost::ProcessRequest().
|
protected |
Definition at line 988 of file httprequest.cpp.
Referenced by ParseRequest().
| void HTTPRequest::SetCookie | ( | const QString & | sKey, |
| const QString & | sValue, | ||
| const QDateTime & | expiryDate, | ||
| bool | secure | ||
| ) |
Definition at line 1859 of file httprequest.cpp.
Referenced by ParseRequest().
|
inline |
Definition at line 251 of file httprequest.h.
Referenced by HttpWorker::run().
|
protected |
Definition at line 943 of file httprequest.cpp.
Referenced by ProcessRequestLine().
|
protected |
Definition at line 230 of file httprequest.cpp.
Referenced by ProcessRequestLine().
| void HTTPRequest::SetResponseHeader | ( | const QString & | sKey, |
| const QString & | sValue, | ||
| bool | replace = false |
||
| ) |
Definition at line 1846 of file httprequest.cpp.
Referenced by AddCORSHeaders(), BuildResponseHeader(), FormatFileResponse(), ParseRequest(), HttpServerExtension::ProcessOptions(), SendResponse(), and SetCookie().
|
static |
Definition at line 1129 of file httprequest.cpp.
Referenced by UPnpCDSTv::LoadRecordings(), ImportConfigurationGroup::probeCard(), DemoConfigurationGroup::probeCard(), and SendResponseFile().
|
pure virtual |
Implemented in BufferedSocketDeviceRequest.
Referenced by SendData(), SendResponse(), and SendResponseFile().
| bool HTTPRequest::m_bEncrypted {false} |
Definition at line 143 of file httprequest.h.
Referenced by HttpWorker::run().
|
private |
Definition at line 167 of file httprequest.h.
Referenced by BuildResponseHeader(), and ParseRequest().
| bool HTTPRequest::m_bSOAPRequest {false} |
Definition at line 145 of file httprequest.h.
Referenced by FormatActionResponse(), FormatErrorResponse(), GetSerializer(), and ProcessSOAPPayload().
| HttpContentType HTTPRequest::m_eContentType {ContentType_Unknown} |
Definition at line 123 of file httprequest.h.
Referenced by ParseRequest(), and SetContentType().
| HttpResponseType HTTPRequest::m_eResponseType {ResponseTypeUnknown} |
Definition at line 150 of file httprequest.h.
Referenced by BuildResponseHeader(), HttpServer::DelegateRequest(), FormatActionResponse(), FormatErrorResponse(), FormatFileResponse(), FormatRawResponse(), MythFEXML::GetActionListTest(), SSDPExtension::GetDeviceDesc(), SSDPExtension::GetDeviceList(), Xsd::GetEnumXSD(), SSDPExtension::GetFile(), InternetContent::GetInternetContent(), InternetContent::GetInternetSearch(), InternetContent::GetInternetSources(), GetResponseType(), MythFEXML::GetScreenShot(), HttpStatus::GetStatusHTML(), HttpStatus::GetStatusXML(), Wsdl::GetWSDL(), Eventing::HandleSubscribe(), Eventing::HandleUnsubscribe(), ParseRequest(), HttpServerExtension::ProcessOptions(), UPNPSubscription::ProcessRequest(), HttpStatus::ProcessRequest(), Xsd::RenderArrayXSD(), Xsd::RenderMapXSD(), Xsd::RenderXSD(), SendResponse(), SendResponseFile(), and SendResponseRedirect().
| HttpRequestType HTTPRequest::m_eType {RequestTypeUnknown} |
Definition at line 122 of file httprequest.h.
Referenced by HttpServer::DelegateRequest(), GetRequestType(), ParseRequest(), Eventing::ProcessRequest(), UPNPSubscription::ProcessRequest(), ServiceHost::ProcessRequest(), ProcessRequestLine(), HttpWorker::run(), SendResponse(), SendResponseFile(), and SetRequestType().
| QStringMap HTTPRequest::m_mapCookies |
Definition at line 135 of file httprequest.h.
Referenced by ParseCookies(), and ParseRequest().
| QStringMultiMap HTTPRequest::m_mapHeaders |
Definition at line 134 of file httprequest.h.
Referenced by BuildResponseHeader(), GetLastHeader(), GetRequestHeader(), ParseCookies(), ParseRequest(), and SendResponse().
| QStringMap HTTPRequest::m_mapParams |
Definition at line 133 of file httprequest.h.
Referenced by Xsd::GetEnumXSD(), InternetContent::GetInternetContent(), InternetContent::GetInternetSearch(), MythFEXML::GetScreenShot(), Wsdl::GetWSDL(), Xsd::GetXSD(), UPnpCDS::HandleBrowse(), UPnpCMGR::HandleGetCurrentConnectionInfo(), UPnpCDS::HandleSearch(), ParseRequest(), UPNPSubscription::ProcessRequest(), ServiceHost::ProcessRequest(), ProcessRequestLine(), ProcessSOAPPayload(), and Xsd::RenderMapXSD().
| QStringMap HTTPRequest::m_mapRespHeaders |
Definition at line 154 of file httprequest.h.
Referenced by BuildResponseHeader(), FormatActionResponse(), FormatErrorResponse(), MythFEXML::GetActionListTest(), SSDPExtension::GetFile(), GetResponseHeaders(), HttpStatus::GetStatusHTML(), HttpStatus::GetStatusXML(), Eventing::HandleSubscribe(), SendResponse(), SendResponseFile(), SendResponseRedirect(), and SetResponseHeader().
|
private |
Definition at line 168 of file httprequest.h.
Referenced by BuildResponseHeader().
| int HTTPRequest::m_nMajor {0} |
Definition at line 140 of file httprequest.h.
Referenced by GetRequestProtocol(), ParseKeepAlive(), ParseRequest(), and SetRequestProtocol().
| int HTTPRequest::m_nMinor {0} |
Definition at line 141 of file httprequest.h.
Referenced by GetRequestProtocol(), ParseKeepAlive(), ParseRequest(), and SetRequestProtocol().
| long HTTPRequest::m_nResponseStatus {200} |
Definition at line 153 of file httprequest.h.
Referenced by HttpServer::DelegateRequest(), FormatActionResponse(), FormatErrorResponse(), FormatFileResponse(), FormatRawResponse(), SSDPExtension::GetDeviceList(), SSDPExtension::GetFile(), InternetContent::GetInternetContent(), GetResponsePage(), GetResponseStatus(), Eventing::HandleSubscribe(), Eventing::HandleUnsubscribe(), ParseRequest(), HttpServerExtension::ProcessOptions(), UPNPSubscription::ProcessRequest(), HttpStatus::ProcessRequest(), ProcessRequestLine(), HttpWorker::run(), SendResponse(), SendResponseFile(), and SendResponseRedirect().
|
protected |
Definition at line 118 of file httprequest.h.
Referenced by ParseRange().
| IPostProcess* HTTPRequest::m_pPostProcess {nullptr} |
Definition at line 160 of file httprequest.h.
Referenced by Eventing::HandleSubscribe(), and HttpWorker::run().
|
protected |
Definition at line 117 of file httprequest.h.
Referenced by ProcessRequestLine().
| QBuffer HTTPRequest::m_response |
Definition at line 158 of file httprequest.h.
Referenced by HttpServer::DelegateRequest(), FormatActionResponse(), FormatErrorResponse(), FormatFileResponse(), FormatRawResponse(), MythFEXML::GetActionListTest(), SSDPExtension::GetDeviceDesc(), Xsd::GetEnumXSD(), SSDPExtension::GetFile(), GetSerializer(), HttpStatus::GetStatusHTML(), HttpStatus::GetStatusXML(), Wsdl::GetWSDL(), ParseRequest(), Xsd::RenderArrayXSD(), Xsd::RenderMapXSD(), Xsd::RenderXSD(), HttpWorker::run(), SendResponse(), and SendResponseFile().
| QString HTTPRequest::m_sBaseUrl |
Definition at line 129 of file httprequest.h.
Referenced by HttpServer::DelegateRequest(), ExtractMethodFromURL(), HttpServer::GetSocketTimeout(), Wsdl::GetWSDL(), UPnpCDS::HandleBrowse(), UPnpCDS::HandleGetFeatureList(), UPnpCDS::HandleGetSearchCapabilities(), UPnpCDS::HandleGetServiceResetToken(), UPnpCDS::HandleGetSortCapabilities(), UPnpCDS::HandleGetSystemUpdateID(), UPnpCDS::HandleSearch(), ParseRequest(), Eventing::ProcessRequest(), SSDPExtension::ProcessRequest(), UPnpCDS::ProcessRequest(), UPnpCMGR::ProcessRequest(), UPnpMSRR::ProcessRequest(), UPNPSubscription::ProcessRequest(), HttpStatus::ProcessRequest(), InternetContent::ProcessRequest(), MythFEXML::ProcessRequest(), ServiceHost::ProcessRequest(), and ProcessRequestLine().
| QString HTTPRequest::m_sFileName |
Definition at line 156 of file httprequest.h.
Referenced by BuildResponseHeader(), FormatFileResponse(), SSDPExtension::GetFile(), InternetContent::GetInternetContent(), MythFEXML::GetScreenShot(), and SendResponse().
| QString HTTPRequest::m_sMethod |
Definition at line 131 of file httprequest.h.
Referenced by ExtractMethodFromURL(), FormatActionResponse(), GetSerializer(), UPnpCDS::HandleBrowse(), UPnpCDS::HandleGetFeatureList(), UPnpCDS::HandleGetSearchCapabilities(), UPnpCDS::HandleGetServiceResetToken(), UPnpCDS::HandleGetSortCapabilities(), UPnpCDS::HandleGetSystemUpdateID(), UPnpCDS::HandleSearch(), ParseRequest(), Eventing::ProcessRequest(), SSDPExtension::ProcessRequest(), UPnpCDS::ProcessRequest(), UPnpCMGR::ProcessRequest(), UPnpMSRR::ProcessRequest(), UPNPSubscription::ProcessRequest(), HttpStatus::ProcessRequest(), InternetContent::ProcessRequest(), MythFEXML::ProcessRequest(), ServiceHost::ProcessRequest(), and ProcessSOAPPayload().
| QString HTTPRequest::m_sNameSpace |
Definition at line 146 of file httprequest.h.
Referenced by FormatActionResponse(), GetSerializer(), and ProcessSOAPPayload().
| QString HTTPRequest::m_sOriginalUrl |
Definition at line 127 of file httprequest.h.
Referenced by ProcessRequestLine().
| QString HTTPRequest::m_sPayload |
Definition at line 137 of file httprequest.h.
Referenced by ParseRequest(), UPNPSubscription::ProcessRequest(), and ProcessSOAPPayload().
| QString HTTPRequest::m_sPrivateToken |
Definition at line 162 of file httprequest.h.
| QString HTTPRequest::m_sProtocol |
Definition at line 139 of file httprequest.h.
Referenced by GetRequestProtocol(), and SetRequestProtocol().
| QString HTTPRequest::m_sRawRequest |
Definition at line 125 of file httprequest.h.
Referenced by UPNPSubscription::ProcessRequest(), InternetContent::ProcessRequest(), MythFEXML::ProcessRequest(), ServiceHost::ProcessRequest(), ProcessRequestLine(), and SendResponseRedirect().
| QString HTTPRequest::m_sRequestUrl |
Definition at line 128 of file httprequest.h.
Referenced by ServiceHost::ProcessRequest(), and ProcessRequestLine().
| QString HTTPRequest::m_sResourceUrl |
Definition at line 130 of file httprequest.h.
Referenced by HttpStatus::ProcessRequest(), ProcessRequestLine(), Xsd::RenderArrayXSD(), Xsd::RenderMapXSD(), and Xsd::RenderXSD().
| QString HTTPRequest::m_sResponseTypeText |
Definition at line 151 of file httprequest.h.
Referenced by BuildResponseHeader(), FormatActionResponse(), and SendResponseFile().
| MythUserSession HTTPRequest::m_userSession |
Definition at line 163 of file httprequest.h.
Referenced by ParseRequest().
|
staticprotected |
Definition at line 115 of file httprequest.h.
Referenced by GetResponseHeaders().