Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CHTTPPythonHandler Class Reference

#include <HTTPPythonHandler.h>

Inheritance diagram for CHTTPPythonHandler:
IHTTPRequestHandler

Public Member Functions

 CHTTPPythonHandler ()
 
 ~CHTTPPythonHandler () override=default
 
IHTTPRequestHandlerCreate (const HTTPRequest &request) const override
 Creates a new HTTP request handler for the given request.
 
bool CanHandleRequest (const HTTPRequest &request) const override
 Checks if the HTTP request handler can handle the given request.
 
bool CanHandleRanges () const override
 Whether the HTTP response could also be provided in ranges.
 
bool CanBeCached () const override
 Whether the HTTP response can be cached.
 
bool GetLastModifiedDate (CDateTime &lastModified) const override
 Returns the last modification date of the response data.
 
MHD_RESULT HandleRequest () override
 Handles the HTTP request.
 
HttpResponseRanges GetResponseData () const override
 Returns the ranges with raw data belonging to the response.
 
std::string GetRedirectUrl () const override
 Returns the URL to which the request should be redirected.
 
int GetPriority () const override
 Returns the priority of the HTTP request handler.
 
- Public Member Functions inherited from IHTTPRequestHandler
virtual ~IHTTPRequestHandler ()=default
 
virtual int GetMaximumAgeForCaching () const
 Returns the maximum age (in seconds) for which the response can be cached.
 
virtual std::string GetResponseFile () const
 Returns the path to the file that should be returned as the response.
 
const HTTPRequestGetRequest () 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 HTTPResponseDetailsGetResponseDetails () 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

 CHTTPPythonHandler (const HTTPRequest &request)
 
bool appendPostData (const char *data, size_t size) override
 
- Protected Member Functions inherited from IHTTPRequestHandler
 IHTTPRequestHandler ()
 
 IHTTPRequestHandler (const HTTPRequest &request)
 
bool GetRequestedRanges (uint64_t totalLength)
 
bool GetHostnameAndPort (std::string &hostname, uint16_t &port)
 

Additional Inherited Members

- Protected Attributes inherited from IHTTPRequestHandler
HTTPRequest m_request
 
HTTPResponseDetails m_response
 
std::map< std::string, std::string > m_postFields
 

Constructor & Destructor Documentation

◆ CHTTPPythonHandler() [1/2]

CHTTPPythonHandler::CHTTPPythonHandler ( )

◆ ~CHTTPPythonHandler()

CHTTPPythonHandler::~CHTTPPythonHandler ( )
overridedefault

◆ CHTTPPythonHandler() [2/2]

CHTTPPythonHandler::CHTTPPythonHandler ( const HTTPRequest & request)
explicitprotected

Member Function Documentation

◆ appendPostData()

bool CHTTPPythonHandler::appendPostData ( const char * data,
size_t size )
overrideprotectedvirtual

Reimplemented from IHTTPRequestHandler.

◆ CanBeCached()

bool CHTTPPythonHandler::CanBeCached ( ) const
inlineoverridevirtual

Whether the HTTP response can be cached.

Reimplemented from IHTTPRequestHandler.

◆ CanHandleRanges()

bool CHTTPPythonHandler::CanHandleRanges ( ) const
inlineoverridevirtual

Whether the HTTP response could also be provided in ranges.

Reimplemented from IHTTPRequestHandler.

◆ CanHandleRequest()

bool CHTTPPythonHandler::CanHandleRequest ( const HTTPRequest & request) const
overridevirtual

Checks if the HTTP request handler can handle the given request.

Parameters
requestHTTP request to be handled
Returns
True if the given HTTP request can be handled otherwise false.

Implements IHTTPRequestHandler.

◆ Create()

IHTTPRequestHandler * CHTTPPythonHandler::Create ( const HTTPRequest & request) const
inlineoverridevirtual

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.

Parameters
requestHTTP request to be handled

Implements IHTTPRequestHandler.

◆ GetLastModifiedDate()

bool CHTTPPythonHandler::GetLastModifiedDate ( CDateTime & lastModified) const
overridevirtual

Returns the last modification date of the response data.

This is only used if the response can be cached.

Reimplemented from IHTTPRequestHandler.

◆ GetPriority()

int CHTTPPythonHandler::GetPriority ( ) const
inlineoverridevirtual

Returns the priority of the HTTP request handler.

The higher the priority the more important is the HTTP request handler.

Reimplemented from IHTTPRequestHandler.

◆ GetRedirectUrl()

std::string CHTTPPythonHandler::GetRedirectUrl ( ) const
inlineoverridevirtual

Returns the URL to which the request should be redirected.

This is only used if the response type is HTTPRedirect.

Reimplemented from IHTTPRequestHandler.

◆ GetResponseData()

HttpResponseRanges CHTTPPythonHandler::GetResponseData ( ) const
inlineoverridevirtual

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 from IHTTPRequestHandler.

◆ HandleRequest()

MHD_RESULT CHTTPPythonHandler::HandleRequest ( )
overridevirtual

Handles the HTTP request.

Returns
MHD_NO if a severe error has occurred otherwise MHD_YES.

Implements IHTTPRequestHandler.


The documentation for this class was generated from the following files: