MythTV  master
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
MythHTTPResponse Class Reference

#include <mythhttpresponse.h>

Collaboration diagram for MythHTTPResponse:
Collaboration graph
[legend]

Public Member Functions

 MythHTTPResponse ()=default
 
 MythHTTPResponse (const HTTPRequest2 &Request)
 
void Finalise (const MythHTTPConfig &Config)
 Complete all necessary headers, add final line break after headers, remove data etc. More...
 
template<class T >
std::enable_if_t< std::is_convertible_v< T, QString >, void > AddHeader (const QString &key, const T &val)
 
template<class T >
std::enable_if_t<!std::is_convertible_v< T, QString >, void > AddHeader (const QString &key, T val)
 

Static Public Member Functions

static HTTPResponse HandleOptions (const HTTPRequest2 &Request)
 
static HTTPResponse ErrorResponse (MythHTTPStatus Status, const QString &ServerName)
 
static HTTPResponse RedirectionResponse (const HTTPRequest2 &Request, const QString &Redirect)
 
static HTTPResponse ErrorResponse (const HTTPRequest2 &Request, const QString &Message={})
 
static HTTPResponse OptionsResponse (const HTTPRequest2 &Request)
 
static HTTPResponse DataResponse (const HTTPRequest2 &Request, const HTTPData &Data)
 
static HTTPResponse FileResponse (const HTTPRequest2 &Request, const HTTPFile &File)
 
static HTTPResponse EmptyResponse (const HTTPRequest2 &Request)
 
static HTTPResponse UpgradeResponse (const HTTPRequest2 &Request, MythSocketProtocol &Protocol, bool &Testing)
 

Public Attributes

QString m_serverName
 
MythHTTPVersion m_version { HTTPOneDotOne }
 
MythHTTPConnection m_connection { HTTPConnectionClose }
 
std::chrono::milliseconds m_timeout { HTTP_SOCKET_TIMEOUT_MS }
 
MythHTTPStatus m_status { HTTPBadRequest }
 
MythHTTPRequestType m_requestType { HTTPGet }
 
int m_allowed { HTTP_DEFAULT_ALLOWED }
 
HTTPHeaders m_requestHeaders { nullptr }
 
HTTPContents m_responseHeaders
 
HTTPVariant m_response { std::monostate() }
 

Protected Member Functions

void AddDefaultHeaders ()
 
void AddContentHeaders ()
 

Detailed Description

Definition at line 16 of file mythhttpresponse.h.

Constructor & Destructor Documentation

◆ MythHTTPResponse() [1/2]

MythHTTPResponse::MythHTTPResponse ( )
default

◆ MythHTTPResponse() [2/2]

MythHTTPResponse::MythHTTPResponse ( const HTTPRequest2 Request)
explicit

Definition at line 20 of file mythhttpresponse.cpp.

Member Function Documentation

◆ HandleOptions()

HTTPResponse MythHTTPResponse::HandleOptions ( const HTTPRequest2 Request)
static

◆ ErrorResponse() [1/2]

HTTPResponse MythHTTPResponse::ErrorResponse ( MythHTTPStatus  Status,
const QString &  ServerName 
)
static

◆ RedirectionResponse()

HTTPResponse MythHTTPResponse::RedirectionResponse ( const HTTPRequest2 Request,
const QString &  Redirect 
)
static

Definition at line 220 of file mythhttpresponse.cpp.

Referenced by MythHTTPService::HTTPRequest().

◆ ErrorResponse() [2/2]

HTTPResponse MythHTTPResponse::ErrorResponse ( const HTTPRequest2 Request,
const QString &  Message = {} 
)
static

Definition at line 230 of file mythhttpresponse.cpp.

◆ OptionsResponse()

HTTPResponse MythHTTPResponse::OptionsResponse ( const HTTPRequest2 Request)
static

Definition at line 240 of file mythhttpresponse.cpp.

Referenced by HandleOptions().

◆ DataResponse()

HTTPResponse MythHTTPResponse::DataResponse ( const HTTPRequest2 Request,
const HTTPData Data 
)
static

◆ FileResponse()

HTTPResponse MythHTTPResponse::FileResponse ( const HTTPRequest2 Request,
const HTTPFile File 
)
static

◆ EmptyResponse()

HTTPResponse MythHTTPResponse::EmptyResponse ( const HTTPRequest2 Request)
static

Definition at line 271 of file mythhttpresponse.cpp.

◆ UpgradeResponse()

HTTPResponse MythHTTPResponse::UpgradeResponse ( const HTTPRequest2 Request,
MythSocketProtocol Protocol,
bool Testing 
)
static

Definition at line 371 of file mythhttpresponse.cpp.

Referenced by MythHTTPSocket::Read().

◆ Finalise()

void MythHTTPResponse::Finalise ( const MythHTTPConfig Config)

Complete all necessary headers, add final line break after headers, remove data etc.

Definition at line 34 of file mythhttpresponse.cpp.

◆ AddHeader() [1/2]

template<class T >
std::enable_if_t<std::is_convertible_v<T, QString>, void> MythHTTPResponse::AddHeader ( const QString &  key,
const T &  val 
)
inline

◆ AddHeader() [2/2]

template<class T >
std::enable_if_t<!std::is_convertible_v<T, QString>, void> MythHTTPResponse::AddHeader ( const QString &  key,
val 
)
inline

Definition at line 42 of file mythhttpresponse.h.

◆ AddDefaultHeaders()

void MythHTTPResponse::AddDefaultHeaders ( )
protected

Definition at line 279 of file mythhttpresponse.cpp.

◆ AddContentHeaders()

void MythHTTPResponse::AddContentHeaders ( )
protected

Definition at line 302 of file mythhttpresponse.cpp.

Member Data Documentation

◆ m_serverName

QString MythHTTPResponse::m_serverName

Definition at line 48 of file mythhttpresponse.h.

Referenced by AddDefaultHeaders().

◆ m_version

MythHTTPVersion MythHTTPResponse::m_version { HTTPOneDotOne }

Definition at line 49 of file mythhttpresponse.h.

Referenced by AddDefaultHeaders(), and MythHTTPEncoding::Compress().

◆ m_connection

MythHTTPConnection MythHTTPResponse::m_connection { HTTPConnectionClose }

Definition at line 50 of file mythhttpresponse.h.

Referenced by AddDefaultHeaders().

◆ m_timeout

std::chrono::milliseconds MythHTTPResponse::m_timeout { HTTP_SOCKET_TIMEOUT_MS }

Definition at line 51 of file mythhttpresponse.h.

Referenced by AddDefaultHeaders().

◆ m_status

MythHTTPStatus MythHTTPResponse::m_status { HTTPBadRequest }

◆ m_requestType

MythHTTPRequestType MythHTTPResponse::m_requestType { HTTPGet }

Definition at line 53 of file mythhttpresponse.h.

Referenced by Finalise().

◆ m_allowed

int MythHTTPResponse::m_allowed { HTTP_DEFAULT_ALLOWED }

Definition at line 54 of file mythhttpresponse.h.

Referenced by Finalise().

◆ m_requestHeaders

HTTPHeaders MythHTTPResponse::m_requestHeaders { nullptr }

Definition at line 55 of file mythhttpresponse.h.

Referenced by AddDefaultHeaders(), MythHTTPEncoding::Compress(), and Finalise().

◆ m_responseHeaders

HTTPContents MythHTTPResponse::m_responseHeaders

Definition at line 56 of file mythhttpresponse.h.

Referenced by AddDefaultHeaders(), and Finalise().

◆ m_response

HTTPVariant MythHTTPResponse::m_response { std::monostate() }

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