RAPP Platform API
|
wrapper for SSL/TLS secure HTTP communication More...
#include <asio_socket_https.hpp>
Public Types | |
typedef boost::asio::ssl::stream < boost::asio::ip::tcp::socket > | boost_tls_socket |
boost tls wraps around a tcp socket More... | |
Public Member Functions | |
asio_socket_https (const std::string token) | |
construct using: More... | |
void | schedule (boost::asio::ip::tcp::resolver::query &query, boost::asio::ip::tcp::resolver &resolver, boost::asio::io_service &io_service) |
Public Member Functions inherited from rapp::cloud::asio_handler | |
asio_handler (const std::string token) | |
ctor More... | |
void | content_length (std::string response, std::size_t &length) |
get the content leangth from More... | |
std::string | decode64 (const std::string &val) |
decode base64 More... | |
std::string | encode64 (const std::string &val) |
encode base64 More... | |
void | error_handler (const boost::system::error_code &error) |
Handle an Error. More... | |
std::string | escape_string (const std::string &str) |
escape JSON strings when sending them over the socket More... | |
bool | has_content_length (std::string response) |
examine if the header response contains a content-length filed More... | |
void | invalid_request (const std::string message) |
Handle Invalid Query - e.g.: response which states our query was invalid. More... | |
std::string | random_boundary () const |
Create a random boundary for the multipart/form in HTTP. More... | |
std::string | strip_header (std::string response) |
remove/strip the HTTP header and More... | |
Protected Member Functions | |
void | check_timeout () |
check timed-out More... | |
void | handle_connect (const boost::system::error_code &error) |
begin connect More... | |
void | handle_handshake (const boost::system::error_code &error) |
handle handshake More... | |
void | handle_read_content (const boost::system::error_code &err) |
Callback for Handling Actual Data Contents. More... | |
void | handle_read_headers (const boost::system::error_code &err) |
Callback for Handling Headers. More... | |
void | handle_read_status_line (const boost::system::error_code &err) |
Callback for handling HTTP Header Response Data. More... | |
void | handle_write (const boost::system::error_code &err) |
Callback for handling request and waiting for response. More... | |
void | reset () |
reset handler (clear data, bytes, etc) and stop connection More... | |
bool | verify_certificate (bool preverified, boost::asio::ssl::verify_context &ctx) |
verify TLS certificate More... | |
Private Attributes | |
boost::asio::ssl::context | ctx_ |
tls context More... | |
std::unique_ptr< boost_tls_socket > | tls_socket_ |
tls/ssl socket wrapper More... | |
Additional Inherited Members | |
Protected Attributes inherited from rapp::cloud::asio_handler | |
std::size_t | bytes_transferred_ = 0 |
Bytes Transferred. More... | |
std::function< void(std::string)> | callback_ |
Callback Handler - use with std::bind or boost variant. More... | |
std::size_t | content_length_ = 0 |
Content-Length. More... | |
std::atomic< bool > | flag_ = {false} |
flag used to extract header More... | |
std::string | header_ |
Header that will be used. More... | |
std::string | json_ |
JSON reply. More... | |
std::string | post_ |
Actual post Data. More... | |
boost::asio::streambuf | request_ |
Request Container. More... | |
boost::asio::streambuf | response_ |
Response Container. More... | |
std::unique_ptr < boost::asio::deadline_timer > | timer_ |
time-out timer More... | |
const std::string | token_ |
user authentication token More... | |
wrapper for SSL/TLS secure HTTP communication
Definition at line 13 of file asio_socket_https.hpp.
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> rapp::cloud::asio_socket_https::boost_tls_socket |
boost tls wraps around a tcp socket
Definition at line 17 of file asio_socket_https.hpp.
rapp::cloud::asio_socket_https::asio_socket_https | ( | const std::string | token | ) |
construct using:
token | authentication token |
user | rapp.cloud username |
Definition at line 24 of file asio_socket_https.hpp.
|
protected |
check timed-out
Definition at line 216 of file asio_socket_https.cpp.
|
protected |
begin connect
Definition at line 68 of file asio_socket_https.cpp.
|
protected |
handle handshake
Definition at line 84 of file asio_socket_https.cpp.
|
protected |
Callback for Handling Actual Data Contents.
err | is a possible error message |
Definition at line 179 of file asio_socket_https.cpp.
|
protected |
Callback for Handling Headers.
err | is a possible error message |
Definition at line 160 of file asio_socket_https.cpp.
|
protected |
Callback for handling HTTP Header Response Data.
err | is a possible error message |
Definition at line 124 of file asio_socket_https.cpp.
|
protected |
Callback for handling request and waiting for response.
err | is a possible error |
Definition at line 105 of file asio_socket_https.cpp.
|
protected |
reset handler (clear data, bytes, etc) and stop connection
Definition at line 203 of file asio_socket_https.cpp.
|
virtual |
schedule this as a job for execution
query | defines the URL/URI |
resolver | resolves the URL/URI address |
io_service | is the queue on which jobs are scheduled |
Implements rapp::cloud::asio_socket.
Definition at line 6 of file asio_socket_https.cpp.
|
protected |
verify TLS certificate
verify TLS certificate - WARNING: is this proper verification?
Definition at line 59 of file asio_socket_https.cpp.
|
private |
tls context
Definition at line 76 of file asio_socket_https.hpp.
|
private |
tls/ssl socket wrapper
Definition at line 74 of file asio_socket_https.hpp.