refactor: Convert boost::beast::string_view to std::string_view (#6306)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
Co-authored-by: Mayukha Vadari <mvadari@gmail.com>
Co-authored-by: Timur Yalymov <36795566+tyalymov@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Vito Tumas <5780819+Tapanito@users.noreply.github.com>
This commit is contained in:
Copilot
2026-08-17 23:19:56 +00:00
committed by GitHub
parent 1b226c8b2e
commit 820ca5b332
8 changed files with 25 additions and 25 deletions

View File

@@ -9,6 +9,7 @@
#include <set> // IWYU pragma: keep
#include <stack>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -87,14 +88,14 @@ public:
}
void
output(boost::beast::string_view const& bytes)
output(std::string_view bytes)
{
markStarted();
output_(bytes);
}
void
stringOutput(boost::beast::string_view const& bytes)
stringOutput(std::string_view bytes)
{
markStarted();
std::size_t position = 0, writtenUntil = 0;

View File

@@ -16,6 +16,7 @@
#include <optional>
#include <ranges>
#include <string>
#include <string_view>
#include <vector>
namespace xrpl {
@@ -52,7 +53,7 @@ to_string(ProtocolVersion const& p)
}
std::vector<ProtocolVersion>
parseProtocolVersions(boost::beast::string_view const& value)
parseProtocolVersions(std::string_view value)
{
static boost::regex const kRE(
"^" // start of line
@@ -119,7 +120,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions)
}
std::optional<ProtocolVersion>
negotiateProtocolVersion(boost::beast::string_view const& versions)
negotiateProtocolVersion(std::string_view versions)
{
auto const them = parseProtocolVersions(versions);

View File

@@ -1,10 +1,9 @@
#pragma once
#include <boost/beast/core/string.hpp>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
@@ -43,7 +42,7 @@ to_string(ProtocolVersion const& p);
* no duplicates and will be sorted in ascending protocol order.
*/
std::vector<ProtocolVersion>
parseProtocolVersions(boost::beast::string_view const& s);
parseProtocolVersions(std::string_view s);
/**
* Given a list of supported protocol versions, choose the one we prefer.
@@ -55,7 +54,7 @@ negotiateProtocolVersion(std::vector<ProtocolVersion> const& versions);
* Given a list of supported protocol versions, choose the one we prefer.
*/
std::optional<ProtocolVersion>
negotiateProtocolVersion(boost::beast::string_view const& versions);
negotiateProtocolVersion(std::string_view versions);
/**
* The list of all the protocol versions we support.

View File

@@ -264,7 +264,7 @@ ServerHandler::onHandoff(
static inline json::Output
makeOutput(Session& session)
{
return [&](boost::beast::string_view const& b) { session.write(b.data(), b.size()); };
return [&](std::string_view b) { session.write(b.data(), b.size()); };
}
static std::map<std::string, std::string>
@@ -564,11 +564,11 @@ ServerHandler::processSession(
makeOutput(*session),
coro,
forwardedFor(session->request()),
[&] {
[&] -> std::string_view {
auto const iter = session->request().find("X-User");
if (iter != session->request().end())
return iter->value();
return boost::beast::string_view{};
return {};
}());
if (beast::rfc2616::isKeepAlive(session->request()))