MySQL 8.0.40
Source Code Documentation
HttpRequest Class Reference

a HTTP request and response. More...

#include <http_request.h>

Classes

class  impl
 

Public Types

using RequestHandler = void(*)(HttpRequest *, void *)
 

Public Member Functions

 HttpRequest (RequestHandler cb, void *arg=nullptr)
 
 HttpRequest (HttpRequest &&)
 
 ~HttpRequest ()
 
HttpHeaders get_output_headers ()
 
HttpHeaders get_input_headers () const
 
HttpBuffer get_output_buffer ()
 
HttpBuffer get_input_buffer () const
 
unsigned get_response_code () const
 
std::string get_response_code_line () const
 
HttpMethod::type get_method () const
 
HttpUri get_uri () const
 
void send_reply (int status_code)
 
void send_reply (int status_code, std::string status_text)
 
void send_reply (int status_code, std::string status_text, HttpBuffer &buffer)
 
void send_error (int status_code)
 
void send_error (int status_code, std::string status_text)
 
 operator bool () const
 
int error_code ()
 
void error_code (int)
 
std::string error_msg ()
 
std::error_code socket_error_code () const
 
void socket_error_code (std::error_code ec)
 
bool is_modified_since (time_t last_modified)
 is request modified since 'last_modified'. More...
 
bool add_last_modified (time_t last_modified)
 add a Last-Modified-Since header to the response headers. More...
 

Static Public Member Functions

static void sync_callback (HttpRequest *, void *)
 

Private Member Functions

 HttpRequest (std::unique_ptr< impl > &&impl)
 

Private Attributes

std::unique_ptr< implpImpl_
 

Friends

class HttpClientConnectionBase
 
class HttpUri
 
class EventHttp
 

Detailed Description

a HTTP request and response.

wraps evhttp_request

Member Typedef Documentation

◆ RequestHandler

using HttpRequest::RequestHandler = void (*)(HttpRequest *, void *)

Constructor & Destructor Documentation

◆ HttpRequest() [1/3]

HttpRequest::HttpRequest ( HttpRequest::RequestHandler  cb,
void *  arg = nullptr 
)

◆ HttpRequest() [2/3]

HttpRequest::HttpRequest ( HttpRequest &&  rhs)

◆ ~HttpRequest()

HttpRequest::~HttpRequest ( )
default

◆ HttpRequest() [3/3]

HttpRequest::HttpRequest ( std::unique_ptr< impl > &&  impl)
private

Member Function Documentation

◆ add_last_modified()

bool HttpRequest::add_last_modified ( time_t  last_modified)

add a Last-Modified-Since header to the response headers.

◆ error_code() [1/2]

int HttpRequest::error_code ( )

◆ error_code() [2/2]

void HttpRequest::error_code ( int  err_code)

◆ error_msg()

std::string HttpRequest::error_msg ( )

◆ get_input_buffer()

HttpBuffer HttpRequest::get_input_buffer ( ) const

◆ get_input_headers()

HttpHeaders HttpRequest::get_input_headers ( ) const

◆ get_method()

HttpMethod::type HttpRequest::get_method ( ) const

◆ get_output_buffer()

HttpBuffer HttpRequest::get_output_buffer ( )

◆ get_output_headers()

HttpHeaders HttpRequest::get_output_headers ( )

◆ get_response_code()

unsigned HttpRequest::get_response_code ( ) const

◆ get_response_code_line()

std::string HttpRequest::get_response_code_line ( ) const

◆ get_uri()

HttpUri HttpRequest::get_uri ( ) const

◆ is_modified_since()

bool HttpRequest::is_modified_since ( time_t  last_modified)

is request modified since 'last_modified'.

Returns
true, if local content is newer than the clients last known date, false otherwise

◆ operator bool()

HttpRequest::operator bool ( ) const

◆ send_error() [1/2]

void HttpRequest::send_error ( int  status_code)
inline

◆ send_error() [2/2]

void HttpRequest::send_error ( int  status_code,
std::string  status_text 
)

◆ send_reply() [1/3]

void HttpRequest::send_reply ( int  status_code)
inline

◆ send_reply() [2/3]

void HttpRequest::send_reply ( int  status_code,
std::string  status_text 
)

◆ send_reply() [3/3]

void HttpRequest::send_reply ( int  status_code,
std::string  status_text,
HttpBuffer buffer 
)

◆ socket_error_code() [1/2]

std::error_code HttpRequest::socket_error_code ( ) const

◆ socket_error_code() [2/2]

void HttpRequest::socket_error_code ( std::error_code  ec)

◆ sync_callback()

void HttpRequest::sync_callback ( HttpRequest req,
void *   
)
static

Friends And Related Function Documentation

◆ EventHttp

friend class EventHttp
friend

◆ HttpClientConnectionBase

friend class HttpClientConnectionBase
friend

◆ HttpUri

friend class HttpUri
friend

Member Data Documentation

◆ pImpl_

std::unique_ptr<impl> HttpRequest::pImpl_
private

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