updated to latest beast directory including moving submodule link url and also porting commands to latest code
This commit is contained in:
parent
b374f45f82
commit
cc1cd1bbbd
7 changed files with 44 additions and 38 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,6 +1,6 @@
|
|||
[submodule "beast"]
|
||||
path = beast
|
||||
url = https://github.com/vinniefalco/Beast.git
|
||||
url = https://github.com/boostorg/beast.git
|
||||
[submodule "miniupnp"]
|
||||
path = miniupnp
|
||||
url = https://github.com/miniupnp/miniupnp.git
|
||||
|
|
2
beast
2
beast
|
@ -1 +1 @@
|
|||
Subproject commit 663c275fc16c2b5e075b96bbe91467f83256df5c
|
||||
Subproject commit c7b830f37f8adc0df63d41ff4d31395ab704516b
|
2
cryptopp
2
cryptopp
|
@ -1 +1 @@
|
|||
Subproject commit 32f715f1d723e2bbb78b44fa9e167da64214e2e6
|
||||
Subproject commit ed4c345ce86aad98c38fac120569eb9406fbfc37
|
2
miniupnp
2
miniupnp
|
@ -1 +1 @@
|
|||
Subproject commit 5923d5de6ffd7960b9362f46735cbb0a6b738adf
|
||||
Subproject commit e24d7eca28022b959b331b08e6918b58b303c1cf
|
|
@ -1119,31 +1119,33 @@ warmed_up (0)
|
|||
{
|
||||
if (!ec)
|
||||
{
|
||||
auto req (std::make_shared <beast::http::request<beast::http::string_body>> ());
|
||||
req->method ("POST");
|
||||
auto req (std::make_shared <boost::beast::http::request<boost::beast::http::string_body>> ());
|
||||
req->method (boost::beast::http::verb::post);
|
||||
req->target (*target);
|
||||
req->version = 11;
|
||||
req->fields.replace("Host", address);
|
||||
req->insert(boost::beast::http::field::host, address);
|
||||
req->body = *body;
|
||||
beast::http::prepare (*req);
|
||||
beast::http::async_write (*sock, *req, [node_l, sock, address, port, req] (boost::system::error_code & ec)
|
||||
//req->prepare (*req);
|
||||
//boost::beast::http::prepare(req);
|
||||
req->prepare_payload();
|
||||
boost::beast::http::async_write (*sock, *req, [node_l, sock, address, port, req] (boost::system::error_code const & ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
auto sb (std::make_shared <beast::flat_buffer> ());
|
||||
auto resp (std::make_shared <beast::http::response <beast::http::string_body>> ());
|
||||
beast::http::async_read (*sock, *sb, *resp, [node_l, sb, resp, sock, address, port] (boost::system::error_code & ec)
|
||||
auto sb (std::make_shared <boost::beast::flat_buffer> ());
|
||||
auto resp (std::make_shared <boost::beast::http::response <boost::beast::http::string_body>> ());
|
||||
boost::beast::http::async_read (*sock, *sb, *resp, [node_l, sb, resp, sock, address, port] (boost::system::error_code const & ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
if (resp->status == 200)
|
||||
if (resp->result() == boost::beast::http::status::ok)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node_l->config.logging.callback_logging ())
|
||||
{
|
||||
BOOST_LOG (node_l->log) << boost::str (boost::format ("Callback to %1%:%2% failed with status: %3%") % address % port % resp->status);
|
||||
BOOST_LOG (node_l->log) << boost::str (boost::format ("Callback to %1%:%2% failed with status: %3%") % address % port % resp->result());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1837,8 +1839,8 @@ socket (service_a)
|
|||
}
|
||||
boost::asio::ip::address address;
|
||||
uint16_t port;
|
||||
beast::flat_buffer buffer;
|
||||
beast::http::response <beast::http::string_body> response;
|
||||
boost::beast::flat_buffer buffer;
|
||||
boost::beast::http::response <boost::beast::http::string_body> response;
|
||||
boost::asio::ip::tcp::socket socket;
|
||||
};
|
||||
class distributed_work : public std::enable_shared_from_this <distributed_work>
|
||||
|
@ -1881,21 +1883,22 @@ void start ()
|
|||
boost::property_tree::write_json (ostream, request);
|
||||
request_string = ostream.str ();
|
||||
}
|
||||
beast::http::request <beast::http::string_body> request;
|
||||
request.method ("POST");
|
||||
boost::beast::http::request <boost::beast::http::string_body> request;
|
||||
request.method (boost::beast::http::verb::post);
|
||||
request.target ("/");
|
||||
request.version = 11;
|
||||
request.body = request_string;
|
||||
beast::http::prepare (request);
|
||||
beast::http::async_write (connection->socket, request, [this_l, connection] (boost::system::error_code const & ec)
|
||||
//boost::beast::http::prepare (request);
|
||||
request.prepare_payload();
|
||||
boost::beast::http::async_write (connection->socket, request, [this_l, connection] (boost::system::error_code const & ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
beast::http::async_read (connection->socket, connection->buffer, connection->response, [this_l, connection] (boost::system::error_code const & ec)
|
||||
boost::beast::http::async_read (connection->socket, connection->buffer, connection->response, [this_l, connection] (boost::system::error_code const & ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
if (connection->response.status == 200)
|
||||
if (connection->response.result() == boost::beast::http::status::ok)
|
||||
{
|
||||
this_l->success (connection->response.body, connection->address);
|
||||
}
|
||||
|
@ -1952,14 +1955,15 @@ void stop ()
|
|||
boost::property_tree::write_json (ostream, request);
|
||||
request_string = ostream.str ();
|
||||
}
|
||||
beast::http::request <beast::http::string_body> request;
|
||||
request.method ("POST");
|
||||
boost::beast::http::request <boost::beast::http::string_body> request;
|
||||
request.method (boost::beast::http::verb::post);
|
||||
request.target ("/");
|
||||
request.version = 11;
|
||||
request.body = request_string;
|
||||
beast::http::prepare (request);
|
||||
//boost::beast::http::prepare (request);
|
||||
request.prepare_payload();
|
||||
auto socket (std::make_shared <boost::asio::ip::tcp::socket> (this_l->node->network.service));
|
||||
beast::http::async_write (*socket, request, [socket] (boost::system::error_code const & ec)
|
||||
boost::beast::http::async_write (*socket, request, [socket] (boost::system::error_code const & ec)
|
||||
{
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2387,7 +2387,7 @@ socket (node_a.network.service)
|
|||
void rai::rpc_connection::parse_connection ()
|
||||
{
|
||||
auto this_l (shared_from_this ());
|
||||
beast::http::async_read (socket, buffer, request, [this_l] (boost::system::error_code const & ec)
|
||||
boost::beast::http::async_read (socket, buffer, request, [this_l] (boost::system::error_code const & ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
|
@ -2401,13 +2401,14 @@ void rai::rpc_connection::parse_connection ()
|
|||
boost::property_tree::write_json (ostream, tree_a);
|
||||
ostream.flush ();
|
||||
auto body (ostream.str ());
|
||||
this_l->res.fields.insert ("content-type", "application/json");
|
||||
this_l->res.fields.insert ("Access-Control-Allow-Origin", "*");
|
||||
this_l->res.status = 200;
|
||||
this_l->res.set ("content-type", "application/json");
|
||||
this_l->res.set ("Access-Control-Allow-Origin", "*");
|
||||
this_l->res.result(boost::beast::http::status::ok);
|
||||
this_l->res.body = body;
|
||||
this_l->res.version = version;
|
||||
beast::http::prepare (this_l->res);
|
||||
beast::http::async_write (this_l->socket, this_l->res, [this_l] (boost::system::error_code const & ec)
|
||||
this_l->res.prepare_payload();
|
||||
//boost::beast::http::prepare (this_l->res);
|
||||
boost::beast::http::async_write (this_l->socket, this_l->res, [this_l] (boost::system::error_code const & ec)
|
||||
{
|
||||
});
|
||||
if (this_l->node->config.logging.log_rpc ())
|
||||
|
@ -2415,7 +2416,7 @@ void rai::rpc_connection::parse_connection ()
|
|||
BOOST_LOG (this_l->node->log) << boost::str (boost::format ("RPC request %2% completed in: %1% microseconds") % std::chrono::duration_cast <std::chrono::microseconds> (std::chrono::system_clock::now () - start).count () % boost::io::group (std::hex, std::showbase, reinterpret_cast <uintptr_t> (this_l.get ())));
|
||||
}
|
||||
});
|
||||
if (this_l->request.method () == "POST")
|
||||
if (this_l->request.method () == boost::beast::http::verb::post)
|
||||
{
|
||||
auto handler (std::make_shared <rai::rpc_handler> (*this_l->node, this_l->rpc, this_l->request.body, response_handler));
|
||||
handler->process_request ();
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
#include <rai/utility.hpp>
|
||||
|
||||
#include <beast/http.hpp>
|
||||
#include <beast/core/flat_buffer.hpp>
|
||||
//#include <boost/beast/http.hpp>
|
||||
//#include <boost/beast/core/flat_buffer.hpp>
|
||||
#include <boost/beast.hpp>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
@ -63,9 +64,9 @@ public:
|
|||
std::shared_ptr <rai::node> node;
|
||||
rai::rpc & rpc;
|
||||
boost::asio::ip::tcp::socket socket;
|
||||
beast::flat_buffer buffer;
|
||||
beast::http::request <beast::http::string_body> request;
|
||||
beast::http::response <beast::http::string_body> res;
|
||||
boost::beast::flat_buffer buffer;
|
||||
boost::beast::http::request <boost::beast::http::string_body> request;
|
||||
boost::beast::http::response <boost::beast::http::string_body> res;
|
||||
};
|
||||
class payment_observer : public std::enable_shared_from_this <rai::payment_observer>
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue