Electroneum
epee::net_utils::http::http_custom_handler< t_connection_context > Class Template Reference

#include <http_protocol_handler.h>

Inheritance diagram for epee::net_utils::http::http_custom_handler< t_connection_context >:
Collaboration diagram for epee::net_utils::http::http_custom_handler< t_connection_context >:

Public Types

typedef custum_handler_config< t_connection_context > config_type
 
- Public Types inherited from epee::net_utils::http::simple_http_connection_handler< t_connection_context >
typedef t_connection_context connection_context
 
typedef http_server_config config_type
 

Public Member Functions

 http_custom_handler (i_service_endpoint *psnd_hndlr, config_type &config, t_connection_context &conn_context)
 
bool handle_request (const http_request_info &query_info, http_response_info &response)
 
virtual bool thread_init ()
 
virtual bool thread_deinit ()
 
void handle_qued_callback ()
 
bool after_init_connection ()
 
- Public Member Functions inherited from epee::net_utils::http::simple_http_connection_handler< t_connection_context >
 simple_http_connection_handler (i_service_endpoint *psnd_hndlr, config_type &config, t_connection_context &conn_context)
 
virtual ~simple_http_connection_handler ()
 
bool release_protocol ()
 
bool after_init_connection ()
 
virtual bool handle_recv (const void *ptr, size_t cb)
 

Additional Inherited Members

- Protected Attributes inherited from epee::net_utils::http::simple_http_connection_handler< t_connection_context >
i_service_endpointm_psnd_hndlr
 
t_connection_context & m_conn_context
 

Detailed Description

template<class t_connection_context = net_utils::connection_context_base>
class epee::net_utils::http::http_custom_handler< t_connection_context >

Definition at line 173 of file http_protocol_handler.h.

Member Typedef Documentation

◆ config_type

template<class t_connection_context = net_utils::connection_context_base>
typedef custum_handler_config<t_connection_context> epee::net_utils::http::http_custom_handler< t_connection_context >::config_type

Definition at line 176 of file http_protocol_handler.h.

Constructor & Destructor Documentation

◆ http_custom_handler()

template<class t_connection_context = net_utils::connection_context_base>
epee::net_utils::http::http_custom_handler< t_connection_context >::http_custom_handler ( i_service_endpoint psnd_hndlr,
config_type config,
t_connection_context &  conn_context 
)
inline

Definition at line 178 of file http_protocol_handler.h.

179  : simple_http_connection_handler<t_connection_context>(psnd_hndlr, config, conn_context),
180  m_config(config),
181  m_auth(m_config.m_user ? http_server_auth{*m_config.m_user, config.rng} : http_server_auth{})
182  {}

Member Function Documentation

◆ after_init_connection()

template<class t_connection_context = net_utils::connection_context_base>
bool epee::net_utils::http::http_custom_handler< t_connection_context >::after_init_connection ( )
inline

Definition at line 214 of file http_protocol_handler.h.

215  {
216  return true;
217  }

◆ handle_qued_callback()

template<class t_connection_context = net_utils::connection_context_base>
void epee::net_utils::http::http_custom_handler< t_connection_context >::handle_qued_callback ( )
inline

Definition at line 212 of file http_protocol_handler.h.

213  {}

◆ handle_request()

template<class t_connection_context = net_utils::connection_context_base>
bool epee::net_utils::http::http_custom_handler< t_connection_context >::handle_request ( const http_request_info query_info,
http_response_info response 
)
inlinevirtual

Reimplemented from epee::net_utils::http::simple_http_connection_handler< t_connection_context >.

Definition at line 183 of file http_protocol_handler.h.

184  {
185  CHECK_AND_ASSERT_MES(m_config.m_phandler, false, "m_config.m_phandler is NULL!!!!");
186 
187  const auto auth_response = m_auth.get_response(query_info);
188  if (auth_response)
189  {
190  response = std::move(*auth_response);
191  return true;
192  }
193 
194  //fill with default values
195  response.m_mime_tipe = "text/plain";
196  response.m_response_code = 200;
197  response.m_response_comment = "OK";
198  response.m_body.clear();
199 
200  return m_config.m_phandler->handle_http_request(query_info, response, this->m_conn_context);
201  }
boost::optional< http_response_info > get_response(const http_request_info &request)
Definition: http_auth.h:79
epee::misc_utils::struct_init< response_t > response
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
Definition: misc_log_ex.h:181
i_http_server_handler< t_connection_context > * m_phandler
const T & move(const T &t)
Definition: gtest-port.h:1317
Here is the call graph for this function:

◆ thread_deinit()

template<class t_connection_context = net_utils::connection_context_base>
virtual bool epee::net_utils::http::http_custom_handler< t_connection_context >::thread_deinit ( )
inlinevirtual

Reimplemented from epee::net_utils::http::simple_http_connection_handler< t_connection_context >.

Definition at line 208 of file http_protocol_handler.h.

209  {
210  return m_config.m_phandler->deinit_server_thread();
211  }
i_http_server_handler< t_connection_context > * m_phandler

◆ thread_init()

template<class t_connection_context = net_utils::connection_context_base>
virtual bool epee::net_utils::http::http_custom_handler< t_connection_context >::thread_init ( )
inlinevirtual

Reimplemented from epee::net_utils::http::simple_http_connection_handler< t_connection_context >.

Definition at line 203 of file http_protocol_handler.h.

204  {
205  return m_config.m_phandler->init_server_thread();;
206  }
i_http_server_handler< t_connection_context > * m_phandler

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