Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
#include <IHTTPRequestHandler.h>
Public Member Functions | |
virtual | ~IHTTPRequestHandler ()=default |
virtual IHTTPRequestHandler * | Create (const HTTPRequest &request) const =0 |
Creates a new HTTP request handler for the given request. | |
virtual int | GetPriority () const |
Returns the priority of the HTTP request handler. | |
virtual bool | CanHandleRequest (const HTTPRequest &request) const =0 |
Checks if the HTTP request handler can handle the given request. | |
virtual MHD_RESULT | HandleRequest ()=0 |
Handles the HTTP request. | |
virtual bool | CanHandleRanges () const |
Whether the HTTP response could also be provided in ranges. | |
virtual bool | CanBeCached () const |
Whether the HTTP response can be cached. | |
virtual int | GetMaximumAgeForCaching () const |
Returns the maximum age (in seconds) for which the response can be cached. | |
virtual bool | GetLastModifiedDate (CDateTime &lastModified) const |
Returns the last modification date of the response data. | |
virtual HttpResponseRanges | GetResponseData () const |
Returns the ranges with raw data belonging to the response. | |
virtual std::string | GetRedirectUrl () const |
Returns the URL to which the request should be redirected. | |
virtual std::string | GetResponseFile () const |
Returns the path to the file that should be returned as the response. | |
const HTTPRequest & | GetRequest () const |
Returns the HTTP request handled by the HTTP request handler. | |
bool | IsRequestRanged () const |
Returns true if the HTTP request is ranged, otherwise false. | |
void | SetRequestRanged (bool ranged) |
Sets whether the HTTP request contains ranges or not. | |
void | SetResponseStatus (int status) |
Sets the response status of the HTTP response. | |
bool | HasResponseHeader (const std::string &field) const |
Checks if the given HTTP header field is part of the response details. | |
bool | AddResponseHeader (const std::string &field, const std::string &value, bool allowMultiple=false) |
Adds the given HTTP header field and value to the response details. | |
const HTTPResponseDetails & | GetResponseDetails () const |
Returns the HTTP response header details. | |
void | AddPostField (const std::string &key, const std::string &value) |
Adds the given key-value pair extracted from the HTTP POST data. | |
bool | AddPostData (const char *data, size_t size) |
Adds the given raw HTTP POST data. | |
Protected Member Functions | |
IHTTPRequestHandler () | |
IHTTPRequestHandler (const HTTPRequest &request) | |
virtual bool | appendPostData (const char *data, size_t size) |
bool | GetRequestedRanges (uint64_t totalLength) |
bool | GetHostnameAndPort (std::string &hostname, uint16_t &port) |
Protected Attributes | |
HTTPRequest | m_request |
HTTPResponseDetails | m_response |
std::map< std::string, std::string > | m_postFields |
|
virtualdefault |
|
protected |
|
explicitprotected |
bool IHTTPRequestHandler::AddPostData | ( | const char * | data, |
size_t | size ) |
void IHTTPRequestHandler::AddPostField | ( | const std::string & | key, |
const std::string & | value ) |
|
inlineprotectedvirtual |
Reimplemented in CHTTPJsonRpcHandler, and CHTTPPythonHandler.
|
inlinevirtual |
Whether the HTTP response can be cached.
Reimplemented in CHTTPFileHandler, CHTTPImageTransformationHandler, and CHTTPPythonHandler.
|
inlinevirtual |
Whether the HTTP response could also be provided in ranges.
Reimplemented in CHTTPFileHandler, CHTTPImageTransformationHandler, and CHTTPPythonHandler.
|
pure virtual |
Checks if the HTTP request handler can handle the given request.
request | HTTP request to be handled |
Implemented in CHTTPImageHandler, CHTTPImageTransformationHandler, CHTTPJsonRpcHandler, CHTTPPythonHandler, CHTTPVfsHandler, CHTTPWebinterfaceAddonsHandler, and CHTTPWebinterfaceHandler.
|
pure virtual |
Creates a new HTTP request handler for the given request.
This call is responsible for doing some preparation work like - depending on the supported features - determining whether the requested entity supports ranges, whether it can be cached and what it's last modified date is.
request | HTTP request to be handled |
Implemented in CHTTPImageHandler, CHTTPImageTransformationHandler, CHTTPJsonRpcHandler, CHTTPPythonHandler, CHTTPVfsHandler, CHTTPWebinterfaceAddonsHandler, and CHTTPWebinterfaceHandler.
|
protected |
|
inlinevirtual |
Returns the last modification date of the response data.
This is only used if the response can be cached.
Reimplemented in CHTTPFileHandler, CHTTPImageTransformationHandler, and CHTTPPythonHandler.
|
inlinevirtual |
Returns the maximum age (in seconds) for which the response can be cached.
This is only used if the response can be cached.
Reimplemented in CHTTPImageHandler.
|
inlinevirtual |
Returns the priority of the HTTP request handler.
The higher the priority the more important is the HTTP request handler.
Reimplemented in CHTTPImageHandler, CHTTPImageTransformationHandler, CHTTPJsonRpcHandler, CHTTPPythonHandler, CHTTPVfsHandler, and CHTTPWebinterfaceAddonsHandler.
|
inlinevirtual |
Returns the URL to which the request should be redirected.
This is only used if the response type is HTTPRedirect.
Reimplemented in CHTTPFileHandler, and CHTTPPythonHandler.
|
inline |
|
protected |
|
inlinevirtual |
Returns the ranges with raw data belonging to the response.
This is only used if the response type is one of the HTTPMemoryDownload types.
Reimplemented in CHTTPImageTransformationHandler, CHTTPJsonRpcHandler, CHTTPPythonHandler, and CHTTPWebinterfaceAddonsHandler.
|
inline |
Returns the HTTP response header details.
|
inlinevirtual |
Returns the path to the file that should be returned as the response.
This is only used if the response type is HTTPFileDownload.
Reimplemented in CHTTPFileHandler.
|
pure virtual |
Handles the HTTP request.
Implemented in CHTTPFileHandler, CHTTPImageTransformationHandler, CHTTPJsonRpcHandler, CHTTPPythonHandler, and CHTTPWebinterfaceAddonsHandler.
bool IHTTPRequestHandler::HasResponseHeader | ( | const std::string & | field | ) | const |
|
inline |
Returns true if the HTTP request is ranged, otherwise false.
Sets whether the HTTP request contains ranges or not.
|
protected |
|
protected |
|
protected |