Update to use latest beast

This commit is contained in:
Miguel Portilla
2017-07-10 19:09:58 -04:00
parent 61316c7f95
commit 95f107d487
29 changed files with 326 additions and 244 deletions

View File

@@ -33,14 +33,13 @@
#include <ripple/overlay/impl/ConnectAttempt.h>
#include <ripple/overlay/impl/OverlayImpl.h>
#include <ripple/overlay/impl/PeerImp.h>
#include <ripple/overlay/impl/TMHello.h>
#include <ripple/peerfinder/make_Manager.h>
#include <ripple/protocol/STExchange.h>
#include <ripple/beast/core/ByteOrder.h>
#include <beast/core/detail/base64.hpp>
#include <ripple/beast/core/LexicalCast.h>
#include <beast/http.hpp>
#include <beast/core/detail/ci_char_traits.hpp>
#include <beast/core/string.hpp>
#include <ripple/beast/utility/WrappedSink.h>
#include <boost/utility/in_place_factory.hpp>
@@ -223,7 +222,7 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
if (std::find_if(types.begin(), types.end(),
[](std::string const& s)
{
return beast::detail::ci_equal(s, "peer");
return beast::detail::iequals(s, "peer");
}) == types.end())
{
handoff.moved = false;
@@ -313,32 +312,6 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
//------------------------------------------------------------------------------
template<class Fields>
static
bool
is_upgrade(beast::http::header<true, Fields> const& req)
{
if(req.version < 11)
return false;
if(req.method() != beast::http::verb::get)
return false;
if(! beast::http::token_list{req["Connection"]}.exists("upgrade"))
return false;
return true;
}
template<class Fields>
static
bool
is_upgrade(beast::http::header<false, Fields> const& req)
{
if(req.version < 11)
return false;
if(! beast::http::token_list{req["Connection"]}.exists("upgrade"))
return false;
return true;
}
bool
OverlayImpl::isPeerUpgrade(http_request_type const& request)
{
@@ -377,7 +350,7 @@ OverlayImpl::makeRedirectResponse (PeerFinder::Slot::ptr const& slot,
for (auto const& _ : m_peerFinder->redirect(slot))
ips.append(_.address.to_string());
}
msg.prepare();
msg.prepare_payload();
return std::make_shared<SimpleWriter>(msg);
}
@@ -394,7 +367,7 @@ OverlayImpl::makeErrorResponse (PeerFinder::Slot::ptr const& slot,
msg.insert("Remote-Address", remote_address.to_string());
msg.insert(beast::http::field::connection, "close");
msg.body = text;
msg.prepare();
msg.prepare_payload();
return std::make_shared<SimpleWriter>(msg);
}
@@ -849,7 +822,7 @@ OverlayImpl::processRequest (http_request_type const& req,
msg.insert("Content-Type", "application/json");
msg.insert("Connection", "close");
msg.body["overlay"] = crawl();
msg.prepare();
msg.prepare_payload();
handoff.response = std::make_shared<SimpleWriter>(msg);
return true;
}