1 #ifndef RAPP_ASIO_HANDLER
2 #define RAPP_ASIO_HANDLER
47 std::string
decode64(
const std::string &val);
52 std::string
encode64(
const std::string &val);
68 std::unique_ptr<boost::asio::deadline_timer>
timer_;
70 std::atomic<bool>
flag_ = {
false};
std::string header_
Header that will be used.
base class for asio handling, including helper methods and most protected members ...
void invalid_request(const std::string message)
Handle Invalid Query - e.g.: response which states our query was invalid.
std::string random_boundary() const
Create a random boundary for the multipart/form in HTTP.
std::size_t content_length_
Content-Length.
std::string escape_string(const std::string &str)
escape JSON strings when sending them over the socket
std::string decode64(const std::string &val)
decode base64
std::string encode64(const std::string &val)
encode base64
void content_length(std::string response, std::size_t &length)
get the content leangth from
std::string post_
Actual post Data.
bool has_content_length(std::string response)
examine if the header response contains a content-length filed
std::atomic< bool > flag_
flag used to extract header
asio_handler(const std::string token)
ctor
boost::asio::streambuf response_
Response Container.
std::string strip_header(std::string response)
remove/strip the HTTP header and
boost::asio::streambuf request_
Request Container.
std::function< void(std::string)> callback_
Callback Handler - use with std::bind or boost variant.
void error_handler(const boost::system::error_code &error)
Handle an Error.
std::string json_
JSON reply.
const std::string token_
user authentication token
std::size_t bytes_transferred_
Bytes Transferred.
std::unique_ptr< boost::asio::deadline_timer > timer_
time-out timer