RAPP Platform API
 All Classes Namespaces Files Functions Variables Typedefs
asio_socket_https.hpp
Go to the documentation of this file.
1 #ifndef RAPP_ASIO_SOCKET_HTTPS
2 #define RAPP_ASIO_SOCKET_HTTPS
3 #include "includes.ihh"
4 namespace rapp {
5 namespace cloud {
14 {
15 public:
17  typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> boost_tls_socket;
18 
24  asio_socket_https(const std::string token)
25  : asio_handler(token), ctx_(boost::asio::ssl::context::tlsv12_client)
26  {
27  // TODO: using this only for TEST
28  header_ = "POST / HTTP/1.1\r\n";
29  }
30 
37  void schedule(
38  boost::asio::ip::tcp::resolver::query & query,
39  boost::asio::ip::tcp::resolver & resolver,
40  boost::asio::io_service & io_service
41  );
42 
43 protected:
45  bool verify_certificate(bool preverified, boost::asio::ssl::verify_context& ctx);
46 
48  void handle_connect(const boost::system::error_code& error);
49 
51  void handle_handshake(const boost::system::error_code& error);
52 
54  void handle_write(const boost::system::error_code & err);
55 
57  void handle_read_status_line(const boost::system::error_code & err);
58 
60  void handle_read_headers(const boost::system::error_code & err);
61 
63  void handle_read_content(const boost::system::error_code & err);
64 
66  void reset();
67 
69  void check_timeout();
70 
71 
72 private:
74  std::unique_ptr<boost_tls_socket> tls_socket_;
76  boost::asio::ssl::context ctx_;
77 };
78 }
79 }
80 #endif
std::unique_ptr< boost_tls_socket > tls_socket_
tls/ssl socket wrapper
std::string header_
Header that will be used.
base class for asio handling, including helper methods and most protected members ...
void handle_connect(const boost::system::error_code &error)
begin connect
boost::asio::ssl::context ctx_
tls context
bool verify_certificate(bool preverified, boost::asio::ssl::verify_context &ctx)
verify TLS certificate
void handle_read_headers(const boost::system::error_code &err)
Callback for Handling Headers.
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > boost_tls_socket
boost tls wraps around a tcp socket
asio_socket_https(const std::string token)
construct using:
void handle_write(const boost::system::error_code &err)
Callback for handling request and waiting for response.
void reset()
reset handler (clear data, bytes, etc) and stop connection
void check_timeout()
check timed-out
void handle_read_status_line(const boost::system::error_code &err)
Callback for handling HTTP Header Response Data.
void handle_handshake(const boost::system::error_code &error)
handle handshake
void schedule(boost::asio::ip::tcp::resolver::query &query, boost::asio::ip::tcp::resolver &resolver, boost::asio::io_service &io_service)
void handle_read_content(const boost::system::error_code &err)
Callback for Handling Actual Data Contents.
wrapper for SSL/TLS secure HTTP communication
Abstract Base ASIO Socket class Use for passing around to the service controller, various types of cl...
Definition: asio_socket.hpp:22