From 8d8907e3406d0e9a8d4916e2f7551099934805bf Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 11 Jan 2017 15:04:23 -0500 Subject: [PATCH] Update for Beast changes --- src/ripple/overlay/impl/ConnectAttempt.cpp | 14 ++++---- src/ripple/overlay/impl/ConnectAttempt.h | 6 ++-- src/ripple/overlay/impl/OverlayImpl.cpp | 28 +++++++-------- src/ripple/overlay/impl/PeerImp.cpp | 14 ++++---- src/ripple/overlay/impl/PeerImp.h | 4 +-- src/ripple/overlay/impl/TMHello.cpp | 4 +-- src/ripple/overlay/impl/TMHello.h | 5 ++- src/ripple/rpc/impl/ServerHandlerImp.cpp | 30 ++++++++-------- src/ripple/rpc/impl/WSInfoSub.h | 2 +- src/ripple/rpc/json_body.h | 18 +++++----- src/ripple/server/Handoff.h | 6 ++-- src/ripple/server/SimpleWriter.h | 4 +-- src/ripple/server/impl/BaseWSPeer.h | 10 +++--- src/ripple/server/impl/PlainWSPeer.h | 4 +-- src/ripple/server/impl/SSLWSPeer.h | 4 +-- src/test/server/ServerStatus_test.cpp | 40 +++++++++++----------- src/test/support/impl/JSONRPCClient.cpp | 10 +++--- 17 files changed, 101 insertions(+), 102 deletions(-) diff --git a/src/ripple/overlay/impl/ConnectAttempt.cpp b/src/ripple/overlay/impl/ConnectAttempt.cpp index 7446b4836..ffc41bbee 100644 --- a/src/ripple/overlay/impl/ConnectAttempt.cpp +++ b/src/ripple/overlay/impl/ConnectAttempt.cpp @@ -221,7 +221,7 @@ ConnectAttempt::onHandshake (error_code ec) overlay_.setup().public_ip, beast::IPAddressConversion::from_asio(remote_endpoint_), app_); - appendHello (req_.headers, hello); + appendHello (req_.fields, hello); setTimer(); beast::http::async_write(stream_, req_, @@ -293,12 +293,12 @@ ConnectAttempt::makeRequest (bool crawl, m.method = "GET"; m.url = "/"; m.version = 11; - m.headers.insert ("User-Agent", BuildInfo::getFullVersionString()); - m.headers.insert ("Upgrade", "RTXP/1.2"); + m.fields.insert ("User-Agent", BuildInfo::getFullVersionString()); + m.fields.insert ("Upgrade", "RTXP/1.2"); //std::string("RTXP/") + to_string (BuildInfo::getCurrentProtocol())); - m.headers.insert ("Connection", "Upgrade"); - m.headers.insert ("Connect-As", "Peer"); - m.headers.insert ("Crawl", crawl ? "public" : "private"); + m.fields.insert ("Connection", "Upgrade"); + m.fields.insert ("Connect-As", "Peer"); + m.fields.insert ("Crawl", crawl ? "public" : "private"); return m; } @@ -343,7 +343,7 @@ ConnectAttempt::processResponse() return close(); } - auto hello = parseHello (false, response_.headers, journal_); + auto hello = parseHello (false, response_.fields, journal_); if(! hello) return fail("processResponse: Bad TMHello"); diff --git a/src/ripple/overlay/impl/ConnectAttempt.h b/src/ripple/overlay/impl/ConnectAttempt.h index dcf6a95f3..e450dd9a3 100644 --- a/src/ripple/overlay/impl/ConnectAttempt.h +++ b/src/ripple/overlay/impl/ConnectAttempt.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -56,10 +56,10 @@ private: using endpoint_type = boost::asio::ip::tcp::endpoint; using request_type = - beast::http::request_v1; + beast::http::request; using response_type = - beast::http::response_v1; + beast::http::response; Application& app_; std::uint32_t const id_; diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp index 508165254..50913b1c5 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -219,7 +219,7 @@ OverlayImpl::onHandoff (std::unique_ptr && ssl_bundle, { auto const types = beast::rfc2616::split_commas( - request.headers["Connect-As"]); + request.fields["Connect-As"]); if (std::find_if(types.begin(), types.end(), [](std::string const& s) { @@ -234,7 +234,7 @@ OverlayImpl::onHandoff (std::unique_ptr && ssl_bundle, } } - auto hello = parseHello (true, request.headers, journal); + auto hello = parseHello (true, request.fields, journal); if(! hello) { m_peerFinder->on_closed(slot); @@ -319,7 +319,7 @@ OverlayImpl::isPeerUpgrade(http_request_type const& request) if (! is_upgrade(request)) return false; auto const versions = parse_ProtocolVersions( - request.headers["Upgrade"]); + request.fields["Upgrade"]); if (versions.size() == 0) return false; return true; @@ -333,7 +333,7 @@ OverlayImpl::isPeerUpgrade(http_response_type const& response) if(response.status != 101) return false; auto const versions = parse_ProtocolVersions( - response.headers["Upgrade"]); + response.fields["Upgrade"]); if (versions.size() == 0) return false; return true; @@ -351,13 +351,13 @@ std::shared_ptr OverlayImpl::makeRedirectResponse (PeerFinder::Slot::ptr const& slot, http_request_type const& request, address_type remote_address) { - beast::http::response_v1 msg; + beast::http::response msg; msg.version = request.version; msg.status = 503; msg.reason = "Service Unavailable"; - msg.headers.insert("Server", BuildInfo::getFullVersionString()); - msg.headers.insert("Remote-Address", remote_address.to_string()); - msg.headers.insert("Content-Type", "application/json"); + msg.fields.insert("Server", BuildInfo::getFullVersionString()); + msg.fields.insert("Remote-Address", remote_address.to_string()); + msg.fields.insert("Content-Type", "application/json"); msg.body = Json::objectValue; { auto const result = m_peerFinder->redirect(slot); @@ -375,12 +375,12 @@ OverlayImpl::makeErrorResponse (PeerFinder::Slot::ptr const& slot, address_type remote_address, std::string text) { - beast::http::response_v1 msg; + beast::http::response msg; msg.version = request.version; msg.status = 400; msg.reason = "Bad Request"; - msg.headers.insert("Server", BuildInfo::getFullVersionString()); - msg.headers.insert("Remote-Address", remote_address.to_string()); + msg.fields.insert("Server", BuildInfo::getFullVersionString()); + msg.fields.insert("Remote-Address", remote_address.to_string()); msg.body = text; prepare(msg, beast::http::connection::close); return std::make_shared(msg); @@ -873,12 +873,12 @@ OverlayImpl::processRequest (http_request_type const& req, if (req.url != "/crawl") return false; - beast::http::response_v1 msg; + beast::http::response msg; msg.version = req.version; msg.status = 200; msg.reason = "OK"; - msg.headers.insert("Server", BuildInfo::getFullVersionString()); - msg.headers.insert("Content-Type", "application/json"); + msg.fields.insert("Server", BuildInfo::getFullVersionString()); + msg.fields.insert("Content-Type", "application/json"); msg.body["overlay"] = crawl(); prepare(msg, beast::http::connection::close); handoff.response = std::make_shared(msg); diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 97fbcb767..f5d3459a0 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -91,7 +91,7 @@ PeerImp::PeerImp (Application& app, id_t id, endpoint_type remote_endpoint, , fee_ (Resource::feeLightPeer) , slot_ (slot) , request_(std::move(request)) - , headers_(request_.headers) + , headers_(request_.fields) { } @@ -652,14 +652,14 @@ PeerImp::makeResponse (bool crawl, resp.status = 101; resp.reason = "Switching Protocols"; resp.version = req.version; - resp.headers.insert("Connection", "Upgrade"); - resp.headers.insert("Upgrade", "RTXP/1.2"); - resp.headers.insert("Connect-AS", "Peer"); - resp.headers.insert("Server", BuildInfo::getFullVersionString()); - resp.headers.insert("Crawl", crawl ? "public" : "private"); + resp.fields.insert("Connection", "Upgrade"); + resp.fields.insert("Upgrade", "RTXP/1.2"); + resp.fields.insert("Connect-AS", "Peer"); + resp.fields.insert("Server", BuildInfo::getFullVersionString()); + resp.fields.insert("Crawl", crawl ? "public" : "private"); protocol::TMHello hello = buildHello(sharedValue, overlay_.setup().public_ip, remote, app_); - appendHello(resp.headers, hello); + appendHello(resp.fields, hello); return resp; } diff --git a/src/ripple/overlay/impl/PeerImp.h b/src/ripple/overlay/impl/PeerImp.h index 9306d7df9..20a941616 100644 --- a/src/ripple/overlay/impl/PeerImp.h +++ b/src/ripple/overlay/impl/PeerImp.h @@ -154,7 +154,7 @@ private: beast::streambuf read_buffer_; http_request_type request_; http_response_type response_; - beast::http::headers const& headers_; + beast::http::fields const& headers_; beast::streambuf write_buffer_; std::queue send_queue_; bool gracefulClose_ = false; @@ -502,7 +502,7 @@ PeerImp::PeerImp (Application& app, std::unique_ptr&& s , fee_ (Resource::feeLightPeer) , slot_ (std::move(slot)) , response_(std::move(response)) - , headers_(response_.headers) + , headers_(response_.fields) { read_buffer_.commit (boost::asio::buffer_copy(read_buffer_.prepare( boost::asio::buffer_size(buffers)), buffers)); diff --git a/src/ripple/overlay/impl/TMHello.cpp b/src/ripple/overlay/impl/TMHello.cpp index 8800ee7d4..9fae0b4b0 100644 --- a/src/ripple/overlay/impl/TMHello.cpp +++ b/src/ripple/overlay/impl/TMHello.cpp @@ -154,7 +154,7 @@ buildHello ( } void -appendHello (beast::http::headers& h, +appendHello (beast::http::fields& h, protocol::TMHello const& hello) { //h.append ("Protocol-Versions",... @@ -222,7 +222,7 @@ parse_ProtocolVersions(boost::string_ref const& value) } boost::optional -parseHello (bool request, beast::http::headers const& h, beast::Journal journal) +parseHello (bool request, beast::http::fields const& h, beast::Journal journal) { // protocol version in TMHello is obsolete, // it is supplanted by the values in the headers. diff --git a/src/ripple/overlay/impl/TMHello.h b/src/ripple/overlay/impl/TMHello.h index 31934ce13..a4ab28175 100644 --- a/src/ripple/overlay/impl/TMHello.h +++ b/src/ripple/overlay/impl/TMHello.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -59,14 +58,14 @@ buildHello (uint256 const& sharedValue, /** Insert HTTP headers based on the TMHello protocol message. */ void -appendHello (beast::http::headers& h, protocol::TMHello const& hello); +appendHello (beast::http::fields& h, protocol::TMHello const& hello); /** Parse HTTP headers into TMHello protocol message. @return A protocol message on success; an empty optional if the parsing failed. */ boost::optional -parseHello (bool request, beast::http::headers const& h, beast::Journal journal); +parseHello (bool request, beast::http::fields const& h, beast::Journal journal); /** Validate and store the public key in the TMHello. This includes signature verification on the shared value. diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index 98e6dc2c3..8e6d14b6c 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -61,7 +61,7 @@ isWebsocketUpgrade( { if (is_upgrade(request)) return beast::detail::ci_equal( - request.headers["Upgrade"], "websocket"); + request.fields["Upgrade"], "websocket"); return false; } @@ -81,19 +81,19 @@ unauthorizedResponse( { using namespace beast::http; Handoff handoff; - response_v1 msg; + response msg; msg.version = request.version; msg.status = 401; msg.reason = "Unauthorized"; - msg.headers.insert("Server", BuildInfo::getFullVersionString()); - msg.headers.insert("Content-Type", "text/html"); + msg.fields.insert("Server", BuildInfo::getFullVersionString()); + msg.fields.insert("Content-Type", "text/html"); msg.body = "Invalid protocol."; prepare(msg, beast::http::connection::close); handoff.response = std::make_shared(msg); return handoff; } -// VFALCO TODO Rewrite to use beast::http::headers +// VFALCO TODO Rewrite to use beast::http::fields static bool authorized ( @@ -269,7 +269,7 @@ Json::Output makeOutput (Session& session) // HACK! static std::map -build_map(beast::http::headers const& h) +build_map(beast::http::fields const& h) { std::map c; for (auto const& e : h) @@ -311,7 +311,7 @@ ServerHandlerImp::onRequest (Session& session) // Check user/password authorization if (! authorized ( - session.port(), build_map(session.request().headers))) + session.port(), build_map(session.request().fields))) { HTTPReply (403, "Forbidden", makeOutput (session), app_.journal ("RPC")); session.close (true); @@ -507,18 +507,18 @@ ServerHandlerImp::processSession (std::shared_ptr const& session, [&] { auto const iter = - session->request().headers.find( + session->request().fields.find( "X-Forwarded-For"); - if(iter != session->request().headers.end()) + if(iter != session->request().fields.end()) return iter->second; return std::string{}; }(), [&] { auto const iter = - session->request().headers.find( + session->request().fields.find( "X-User"); - if(iter != session->request().headers.end()) + if(iter != session->request().fields.end()) return iter->second; return std::string{}; }()); @@ -728,7 +728,7 @@ ServerHandlerImp::statusResponse( { using namespace beast::http; Handoff handoff; - response_v1 msg; + response msg; std::string reason; if (app_.serverOkay(reason)) { @@ -747,8 +747,8 @@ ServerHandlerImp::statusResponse( reason + ""; } msg.version = request.version; - msg.headers.insert("Server", BuildInfo::getFullVersionString()); - msg.headers.insert("Content-Type", "text/html"); + msg.fields.insert("Server", BuildInfo::getFullVersionString()); + msg.fields.insert("Content-Type", "text/html"); prepare(msg, beast::http::connection::close); handoff.response = std::make_shared(msg); return handoff; diff --git a/src/ripple/rpc/impl/WSInfoSub.h b/src/ripple/rpc/impl/WSInfoSub.h index c7f884891..e27677b0d 100644 --- a/src/ripple/rpc/impl/WSInfoSub.h +++ b/src/ripple/rpc/impl/WSInfoSub.h @@ -42,7 +42,7 @@ public: : InfoSub(source) , ws_(ws) { - auto const& h = ws->request().headers; + auto const& h = ws->request().fields; auto it = h.find("X-User"); if (it != h.end() && isIdentified( diff --git a/src/ripple/rpc/json_body.h b/src/ripple/rpc/json_body.h index 0ecad3dcf..d526d6093 100644 --- a/src/ripple/rpc/json_body.h +++ b/src/ripple/rpc/json_body.h @@ -22,7 +22,7 @@ #include #include -#include +#include namespace ripple { @@ -36,10 +36,10 @@ struct json_body beast::streambuf sb_; public: - template + template explicit writer(beast::http::message< - isRequest, json_body, Headers> const& m) + isRequest, json_body, Fields> const& m) noexcept { stream(m.body, [&](void const* data, std::size_t n) @@ -50,22 +50,22 @@ struct json_body } void - init(beast::error_code&) + init(beast::error_code&) noexcept { } std::uint64_t - content_length() const + content_length() const noexcept { return sb_.size(); } - template + template boost::tribool - operator()(beast::http::resume_context&&, - beast::error_code&, Write&& write) + write(beast::http::resume_context&&, + beast::error_code&, Writef&& wf) noexcept { - write(sb_.data()); + wf(sb_.data()); return true; } }; diff --git a/src/ripple/server/Handoff.h b/src/ripple/server/Handoff.h index 976239786..474d67955 100644 --- a/src/ripple/server/Handoff.h +++ b/src/ripple/server/Handoff.h @@ -21,17 +21,17 @@ #define RIPPLE_SERVER_HANDOFF_H_INCLUDED #include -#include +#include #include #include namespace ripple { using http_request_type = - beast::http::request_v1; + beast::http::request; using http_response_type = - beast::http::response_v1; + beast::http::response; /** Used to indicate the result of a server connection handoff. */ struct Handoff diff --git a/src/ripple/server/SimpleWriter.h b/src/ripple/server/SimpleWriter.h index 64ccd2f70..a05d8cfbe 100644 --- a/src/ripple/server/SimpleWriter.h +++ b/src/ripple/server/SimpleWriter.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -37,7 +37,7 @@ class SimpleWriter : public Writer public: template explicit - SimpleWriter(beast::http::message_v1< + SimpleWriter(beast::http::message< isRequest, Body, Headers> const& msg) { beast::write(sb_, msg); diff --git a/src/ripple/server/impl/BaseWSPeer.h b/src/ripple/server/impl/BaseWSPeer.h index 4391add5b..cbc5c6243 100644 --- a/src/ripple/server/impl/BaseWSPeer.h +++ b/src/ripple/server/impl/BaseWSPeer.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include namespace ripple { @@ -67,7 +67,7 @@ public: Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request_v1&& request, + beast::http::request&& request, boost::asio::io_service& io_service, beast::Journal journal); @@ -112,7 +112,7 @@ protected: void operator()(beast::http::message& req) { - req.headers.replace("User-Agent", + req.fields.replace("User-Agent", BuildInfo::getFullVersionString()); } @@ -120,7 +120,7 @@ protected: void operator()(beast::http::message& resp) { - resp.headers.replace("Server", + resp.fields.replace("Server", BuildInfo::getFullVersionString()); } }; @@ -175,7 +175,7 @@ BaseWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request_v1&& request, + beast::http::request&& request, boost::asio::io_service& io_service, beast::Journal journal) : BasePeer(port, handler, remote_address, diff --git a/src/ripple/server/impl/PlainWSPeer.h b/src/ripple/server/impl/PlainWSPeer.h index 73e32de2b..8e84140a5 100644 --- a/src/ripple/server/impl/PlainWSPeer.h +++ b/src/ripple/server/impl/PlainWSPeer.h @@ -48,7 +48,7 @@ public: Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request_v1&& request, + beast::http::request&& request, socket_type&& socket, beast::Journal journal); @@ -66,7 +66,7 @@ PlainWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request_v1&& request, + beast::http::request&& request, socket_type&& socket, beast::Journal journal) : BaseWSPeer(port, handler, remote_address, diff --git a/src/ripple/server/impl/SSLWSPeer.h b/src/ripple/server/impl/SSLWSPeer.h index 99341c07a..2f208217e 100644 --- a/src/ripple/server/impl/SSLWSPeer.h +++ b/src/ripple/server/impl/SSLWSPeer.h @@ -54,7 +54,7 @@ public: Port const& port, Handler& handler, endpoint_type remote_endpoint, - beast::http::request_v1&& request, + beast::http::request&& request, std::unique_ptr< beast::asio::ssl_bundle>&& ssl_bundle, beast::Journal journal); @@ -76,7 +76,7 @@ SSLWSPeer( Port const& port, Handler& handler, endpoint_type remote_endpoint, - beast::http::request_v1&& request, + beast::http::request&& request, std::unique_ptr< beast::asio::ssl_bundle>&& ssl_bundle, beast::Journal journal) diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index ebc81d14d..5f52b6cfd 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -84,18 +84,18 @@ class ServerStatus_test : { using namespace boost::asio; using namespace beast::http; - request_v1 req; + request req; req.url = "/"; req.version = 11; - req.headers.insert("Host", host + ":" + to_string(port)); - req.headers.insert("User-Agent", "test"); + req.fields.insert("Host", host + ":" + to_string(port)); + req.fields.insert("User-Agent", "test"); req.method = "GET"; - req.headers.insert("Upgrade", "websocket"); + req.fields.insert("Upgrade", "websocket"); beast::websocket::detail::maskgen maskgen; std::string key = beast::websocket::detail::make_sec_ws_key(maskgen); - req.headers.insert("Sec-WebSocket-Key", key); - req.headers.insert("Sec-WebSocket-Version", "13"); + req.fields.insert("Sec-WebSocket-Key", key); + req.fields.insert("Sec-WebSocket-Version", "13"); prepare(req, connection::upgrade); return req; } @@ -107,12 +107,12 @@ class ServerStatus_test : { using namespace boost::asio; using namespace beast::http; - request_v1 req; + request req; req.url = "/"; req.version = 11; - req.headers.insert("Host", host + ":" + to_string(port)); - req.headers.insert("User-Agent", "test"); + req.fields.insert("Host", host + ":" + to_string(port)); + req.fields.insert("User-Agent", "test"); if(body.empty()) { req.method = "GET"; @@ -120,7 +120,7 @@ class ServerStatus_test : else { req.method = "POST"; - req.headers.insert("Content-Type", "application/json; charset=UTF-8"); + req.fields.insert("Content-Type", "application/json; charset=UTF-8"); req.body = body; } prepare(req); @@ -131,11 +131,11 @@ class ServerStatus_test : void doRequest( boost::asio::yield_context& yield, - beast::http::request_v1 const& req, + beast::http::request const& req, std::string const& host, uint16_t port, bool secure, - beast::http::response_v1& resp, + beast::http::response& resp, boost::system::error_code& ec) { using namespace boost::asio; @@ -190,7 +190,7 @@ class ServerStatus_test : test::jtx::Env& env, boost::asio::yield_context& yield, bool secure, - beast::http::response_v1& resp, + beast::http::response& resp, boost::system::error_code& ec) { auto const port = env.app().config()["port_ws"]. @@ -207,7 +207,7 @@ class ServerStatus_test : test::jtx::Env& env, boost::asio::yield_context& yield, bool secure, - beast::http::response_v1& resp, + beast::http::response& resp, boost::system::error_code& ec, std::string const& body = "") { @@ -285,7 +285,7 @@ class ServerStatus_test : //non-secure request { boost::system::error_code ec; - beast::http::response_v1 resp; + beast::http::response resp; doWSRequest(env, yield, false, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; @@ -295,7 +295,7 @@ class ServerStatus_test : //secure request { boost::system::error_code ec; - beast::http::response_v1 resp; + beast::http::response resp; doWSRequest(env, yield, true, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; @@ -320,7 +320,7 @@ class ServerStatus_test : //non-secure request { boost::system::error_code ec; - beast::http::response_v1 resp; + beast::http::response resp; doHTTPRequest(env, yield, false, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; @@ -330,7 +330,7 @@ class ServerStatus_test : //secure request { boost::system::error_code ec; - beast::http::response_v1 resp; + beast::http::response resp; doHTTPRequest(env, yield, true, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; @@ -359,7 +359,7 @@ class ServerStatus_test : get("ip"); boost::system::error_code ec; - response_v1 resp; + response resp; auto req = makeWSUpgrade(*ip, *port); //truncate the request message to near the value of the version header @@ -400,7 +400,7 @@ class ServerStatus_test : using namespace jtx; Env env {*this, makeConfig(server_protocol)}; - beast::http::response_v1 resp; + beast::http::response resp; boost::system::error_code ec; // The essence of this test is to have a client and server configured // out-of-phase with respect to ssl (secure client and insecure server diff --git a/src/test/support/impl/JSONRPCClient.cpp b/src/test/support/impl/JSONRPCClient.cpp index ad39587ea..9448b99f8 100644 --- a/src/test/support/impl/JSONRPCClient.cpp +++ b/src/test/support/impl/JSONRPCClient.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -108,12 +108,12 @@ public: using namespace boost::asio; using namespace std::string_literals; - request_v1 req; + request req; req.method = "POST"; req.url = "/"; req.version = 11; - req.headers.insert("Content-Type", "application/json; charset=UTF-8"); - req.headers.insert("Host", + req.fields.insert("Content-Type", "application/json; charset=UTF-8"); + req.fields.insert("Host", ep_.address().to_string() + ":" + std::to_string(ep_.port())); { Json::Value jr; @@ -134,7 +134,7 @@ public: prepare(req); write(stream_, req); - response_v1 res; + response res; read(stream_, bin_, res); Json::Reader jr;