Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Attributes | Private Types | List of all members
cHttpSchemeHandler Class Reference

cSchemeHandler descendant that handles HTTP (and HTTPS) requests. More...

Inheritance diagram for cHttpSchemeHandler:
Inheritance graph
[legend]
Collaboration diagram for cHttpSchemeHandler:
Collaboration graph
[legend]

Public Member Functions

 cHttpSchemeHandler (cUrlClientRequest &a_ParentRequest, bool a_IsTls)
 
virtual void OnBodyData (const void *a_Data, size_t a_Size) override
 Called for each chunk of the incoming body data. More...
 
virtual void OnBodyFinished (void) override
 Called when the entire body has been reported by OnBodyData(). More...
 
virtual void OnConnected (cTCPLink &a_Link) override
 
virtual void OnError (const AString &a_ErrorDescription) override
 Called when an error has occured while parsing. More...
 
virtual void OnFirstLine (const AString &a_FirstLine) override
 Called when the first line of the request or response is fully parsed. More...
 
virtual void OnHeaderLine (const AString &a_Key, const AString &a_Value) override
 Called when a single header line is parsed. More...
 
virtual void OnHeadersFinished (void) override
 Called when all the headers have been parsed. More...
 
virtual void OnReceivedData (const char *a_Data, size_t a_Length) override
 
virtual void OnRemoteClosed (void) override
 
virtual void OnTlsHandshakeCompleted (void) override
 
void SendRequest ()
 Sends the HTTP request over the link. More...
 

Protected Attributes

bool m_IsRedirect
 Set to true if the first line contains a redirecting HTTP status code and the options specify to follow redirects. More...
 
bool m_IsTls
 If true, the TLS should be started on the link before sending the request (used for https). More...
 
cTCPLinkm_Link
 The network link. More...
 
cHTTPMessageParser m_Parser
 Parser of the HTTP response message. More...
 
AString m_RedirectLocation
 The Location where the request should be redirected. More...
 

Private Types

using Super = cSchemeHandler
 

Additional Inherited Members

- Protected Member Functions inherited from cHTTPMessageParser::cCallbacks
virtual ~cCallbacks ()
 

Detailed Description

cSchemeHandler descendant that handles HTTP (and HTTPS) requests.

Definition at line 306 of file UrlClient.cpp.

Member Typedef Documentation

◆ Super

using cHttpSchemeHandler::Super = cSchemeHandler
private

Definition at line 310 of file UrlClient.cpp.

Constructor & Destructor Documentation

◆ cHttpSchemeHandler()

cHttpSchemeHandler::cHttpSchemeHandler ( cUrlClientRequest a_ParentRequest,
bool  a_IsTls 
)
inline

Definition at line 314 of file UrlClient.cpp.

Member Function Documentation

◆ OnBodyData()

virtual void cHttpSchemeHandler::OnBodyData ( const void *  a_Data,
size_t  a_Size 
)
inlineoverridevirtual

Called for each chunk of the incoming body data.

Implements cHTTPMessageParser::cCallbacks.

Definition at line 469 of file UrlClient.cpp.

◆ OnBodyFinished()

virtual void cHttpSchemeHandler::OnBodyFinished ( void  )
inlineoverridevirtual

Called when the entire body has been reported by OnBodyData().

Implements cHTTPMessageParser::cCallbacks.

Definition at line 479 of file UrlClient.cpp.

◆ OnConnected()

virtual void cHttpSchemeHandler::OnConnected ( cTCPLink a_Link)
inlineoverridevirtual

Definition at line 323 of file UrlClient.cpp.

◆ OnError()

virtual void cHttpSchemeHandler::OnError ( const AString a_ErrorDescription)
inlineoverridevirtual

Called when an error has occured while parsing.

Implements cHTTPMessageParser::cCallbacks.

Definition at line 395 of file UrlClient.cpp.

◆ OnFirstLine()

virtual void cHttpSchemeHandler::OnFirstLine ( const AString a_FirstLine)
inlineoverridevirtual

Called when the first line of the request or response is fully parsed.

Doesn't check the validity of the line, only extracts the first complete line.

Implements cHTTPMessageParser::cCallbacks.

Definition at line 402 of file UrlClient.cpp.

◆ OnHeaderLine()

virtual void cHttpSchemeHandler::OnHeaderLine ( const AString a_Key,
const AString a_Value 
)
inlineoverridevirtual

Called when a single header line is parsed.

Implements cHTTPMessageParser::cCallbacks.

Definition at line 442 of file UrlClient.cpp.

◆ OnHeadersFinished()

virtual void cHttpSchemeHandler::OnHeadersFinished ( void  )
inlineoverridevirtual

Called when all the headers have been parsed.

Implements cHTTPMessageParser::cCallbacks.

Definition at line 459 of file UrlClient.cpp.

◆ OnReceivedData()

virtual void cHttpSchemeHandler::OnReceivedData ( const char *  a_Data,
size_t  a_Length 
)
inlineoverridevirtual

Definition at line 371 of file UrlClient.cpp.

◆ OnRemoteClosed()

virtual void cHttpSchemeHandler::OnRemoteClosed ( void  )
inlineoverridevirtual

Definition at line 388 of file UrlClient.cpp.

◆ OnTlsHandshakeCompleted()

virtual void cHttpSchemeHandler::OnTlsHandshakeCompleted ( void  )
inlineoverridevirtual

Definition at line 382 of file UrlClient.cpp.

◆ SendRequest()

void cHttpSchemeHandler::SendRequest ( )
inline

Sends the HTTP request over the link.

Common code for both HTTP and HTTPS.

Definition at line 339 of file UrlClient.cpp.

Member Data Documentation

◆ m_IsRedirect

bool cHttpSchemeHandler::m_IsRedirect
protected

Set to true if the first line contains a redirecting HTTP status code and the options specify to follow redirects.

If true, and the parent request allows redirects, neither headers not the body contents are reported through the callbacks, and after the entire request is parsed, the redirect is attempted.

Definition at line 514 of file UrlClient.cpp.

◆ m_IsTls

bool cHttpSchemeHandler::m_IsTls
protected

If true, the TLS should be started on the link before sending the request (used for https).

Definition at line 509 of file UrlClient.cpp.

◆ m_Link

cTCPLink* cHttpSchemeHandler::m_Link
protected

The network link.

Definition at line 503 of file UrlClient.cpp.

◆ m_Parser

cHTTPMessageParser cHttpSchemeHandler::m_Parser
protected

Parser of the HTTP response message.

Definition at line 506 of file UrlClient.cpp.

◆ m_RedirectLocation

AString cHttpSchemeHandler::m_RedirectLocation
protected

The Location where the request should be redirected.

Only used when m_IsRedirect is true.

Definition at line 518 of file UrlClient.cpp.


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