Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ bin64/
# Because of CMake and VS2017
Win32/
x64/

12 changes: 6 additions & 6 deletions doc/qbk/04_http/08_chunked_encoding.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ interface provided by __parser__:
```
void
callback(
std::uint64_t size, // Size of the chunk, zero for the last chunk
string_view extensions, // The chunk-extensions in raw form
error_code& ec); // May be set by the callback to indicate an error
std::uint64_t size, // Size of the chunk, zero for the last chunk
core::string_view extensions, // The chunk-extensions in raw form
error_code& ec); // May be set by the callback to indicate an error
```
]
][
Expand All @@ -204,9 +204,9 @@ interface provided by __parser__:
```
std::size_t
callback(
std::uint64_t remain, // Octets remaining in this chunk, includes `body`
string_view body, // A buffer holding some or all of the remainder of the chunk body
error_code& ec); // May be set by the callback to indicate an error
std::uint64_t remain, // Octets remaining in this chunk, includes `body`
core::string_view body, // A buffer holding some or all of the remainder of the chunk body
error_code& ec); // May be set by the callback to indicate an error
```
]
]]
Expand Down
8 changes: 4 additions & 4 deletions doc/qbk/07_concepts/Fields.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In this table:
* `c` denotes a (possibly const) value of type `F`.
* `b` is a value of type `bool`
* `n` is a value of type `boost::optional<std::uint64_t>`.
* `s` is a value of type [link beast.ref.boost__beast__string_view `string_view`].
* `s` is a value of type [link beast.ref.boost__beast__string_view `core::string_view`].
* `v` is a value of type `unsigned int` representing the HTTP-version.

[table Valid expressions
Expand All @@ -43,7 +43,7 @@ In this table:
]
][
[`c.get_method_impl()`]
[`string_view`]
[`core::string_view`]
[
Returns the method text.
The implementation only calls this function for request
Expand All @@ -52,14 +52,14 @@ In this table:
]
][
[`c.get_target_impl()`]
[`string_view`]
[`core::string_view`]
[
Returns the target string.
The implementation only calls this function for request headers.
]
][
[`c.get_reason_impl()`]
[`string_view`]
[`core::string_view`]
[
Returns the obsolete request text.
The implementation only calls this for response headers when
Expand Down
26 changes: 13 additions & 13 deletions doc/qbk/08_design/1_http_message.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ a requirement to the [*Fields] type. First, the interface change:
template<class Fields>
struct header<true, Fields> : Fields
{
int version;
int version;

verb method() const;
string_view method_string() const;
void method(verb);
void method(string_view);
verb method() const;
core::string_view method_string() const;
void method(verb);
void method(core::string_view);

string_view target(); const;
void target(string_view);
core::string_view target(); const;
void target(core::string_view);

private:
verb method_;
Expand All @@ -272,10 +272,10 @@ private:
template<class Fields>
struct header<false, Fields> : Fields
{
int version;
int result;
string_view reason() const;
void reason(string_view);
int version;
int result;
core::string_view reason() const;
void reason(core::string_view);
};
```

Expand All @@ -298,14 +298,14 @@ struct header<false, Fields> : Fields
int version;
int status;

string_view
core::string_view
reason() const
{
return this->reason_impl(); // protected member of Fields
}

void
reason(string_view s)
reason(core::string_view s)
{
this->reason_impl(s); // protected member of Fields
}
Expand Down
2 changes: 1 addition & 1 deletion doc/qbk/release_notes.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
* [issue 1956] Deprecate `string_param` (API Change)
['Actions Required]
`string_param`, which was previously the argument type when setting field values
has been replaced by `string_view`. Because of this, it is no longer possible to
has been replaced by `core::string_view`. Because of this, it is no longer possible to
set message field values directly as integrals.
Users are requied to convert numeric arguments to a string type prior to calling
`fields::set` et. al.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ using stream_type = typename beast::tcp_stream::rebind_executor<executor_type>
using acceptor_type = typename net::ip::tcp::acceptor::rebind_executor<executor_type>::other;

// Return a reasonable mime type based on the extension of a file.
beast::string_view
mime_type(beast::string_view path)
boost::core::string_view
mime_type(boost::core::string_view path)
{
using beast::iequals;
auto const ext = [&path]
{
auto const pos = path.rfind(".");
if(pos == beast::string_view::npos)
return beast::string_view{};
if(pos == boost::core::string_view::npos)
return boost::core::string_view{};
return path.substr(pos);
}();
if(iequals(ext, ".htm")) return "text/html";
Expand Down Expand Up @@ -81,8 +81,8 @@ mime_type(beast::string_view path)
// The returned path is normalized for the platform.
std::string
path_cat(
beast::string_view base,
beast::string_view path)
boost::core::string_view base,
boost::core::string_view path)
{
if(base.empty())
return std::string(path);
Expand Down Expand Up @@ -111,12 +111,12 @@ path_cat(
template<class Body, class Allocator>
http::message_generator
handle_request(
beast::string_view doc_root,
boost::core::string_view doc_root,
http::request<Body, http::basic_fields<Allocator>>&& req)
{
// Returns a bad request response
auto const bad_request =
[&req](beast::string_view why)
[&req](boost::core::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -129,7 +129,7 @@ handle_request(

// Returns a not found response
auto const not_found =
[&req](beast::string_view target)
[&req](boost::core::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -142,7 +142,7 @@ handle_request(

// Returns a server error response
auto const server_error =
[&req](beast::string_view what)
[&req](boost::core::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -161,7 +161,7 @@ handle_request(
// Request path must be absolute and not contain "..".
if( req.target().empty() ||
req.target()[0] != '/' ||
req.target().find("..") != beast::string_view::npos)
req.target().find("..") != boost::core::string_view::npos)
return bad_request("Illegal request-target");

// Build the path to the requested file
Expand Down Expand Up @@ -416,7 +416,7 @@ net::awaitable<void, executor_type>
run_session(
Stream& stream,
beast::flat_buffer& buffer,
beast::string_view doc_root)
boost::core::string_view doc_root)
{
auto cs = co_await net::this_coro::cancellation_state;

Expand Down Expand Up @@ -457,7 +457,7 @@ net::awaitable<void, executor_type>
detect_session(
stream_type stream,
ssl::context& ctx,
beast::string_view doc_root)
boost::core::string_view doc_root)
{
beast::flat_buffer buffer;

Expand Down Expand Up @@ -509,7 +509,7 @@ listen(
task_group& task_group,
ssl::context& ctx,
net::ip::tcp::endpoint endpoint,
beast::string_view doc_root)
boost::core::string_view doc_root)
{
auto cs = co_await net::this_coro::cancellation_state;
auto executor = co_await net::this_coro::executor;
Expand Down Expand Up @@ -600,7 +600,7 @@ main(int argc, char* argv[])
auto const address = net::ip::make_address(argv[1]);
auto const port = static_cast<unsigned short>(std::atoi(argv[2]));
auto const endpoint = net::ip::tcp::endpoint{ address, port };
auto const doc_root = beast::string_view{ argv[3] };
auto const doc_root = boost::core::string_view{ argv[3] };
auto const threads = std::max<int>(1, std::atoi(argv[4]));

// The io_context is required for all I/O
Expand Down
22 changes: 11 additions & 11 deletions example/advanced/server-flex/advanced_server_flex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>

// Return a reasonable mime type based on the extension of a file.
beast::string_view
mime_type(beast::string_view path)
boost::core::string_view
mime_type(boost::core::string_view path)
{
using beast::iequals;
auto const ext = [&path]
{
auto const pos = path.rfind(".");
if(pos == beast::string_view::npos)
return beast::string_view{};
if(pos == boost::core::string_view::npos)
return boost::core::string_view{};
return path.substr(pos);
}();
if(iequals(ext, ".htm")) return "text/html";
Expand Down Expand Up @@ -83,8 +83,8 @@ mime_type(beast::string_view path)
// The returned path is normalized for the platform.
std::string
path_cat(
beast::string_view base,
beast::string_view path)
boost::core::string_view base,
boost::core::string_view path)
{
if(base.empty())
return std::string(path);
Expand Down Expand Up @@ -113,12 +113,12 @@ path_cat(
template<class Body, class Allocator>
http::message_generator
handle_request(
beast::string_view doc_root,
boost::core::string_view doc_root,
http::request<Body, http::basic_fields<Allocator>>&& req)
{
// Returns a bad request response
auto const bad_request =
[&req](beast::string_view why)
[&req](boost::core::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -131,7 +131,7 @@ handle_request(

// Returns a not found response
auto const not_found =
[&req](beast::string_view target)
[&req](boost::core::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -144,7 +144,7 @@ handle_request(

// Returns a server error response
auto const server_error =
[&req](beast::string_view what)
[&req](boost::core::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -163,7 +163,7 @@ handle_request(
// Request path must be absolute and not contain "..".
if( req.target().empty() ||
req.target()[0] != '/' ||
req.target().find("..") != beast::string_view::npos)
req.target().find("..") != boost::core::string_view::npos)
return bad_request("Illegal request-target");

// Build the path to the requested file
Expand Down
22 changes: 11 additions & 11 deletions example/advanced/server/advanced_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ namespace net = boost::asio; // from <boost/asio.hpp>
using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>

// Return a reasonable mime type based on the extension of a file.
beast::string_view
mime_type(beast::string_view path)
boost::core::string_view
mime_type(boost::core::string_view path)
{
using beast::iequals;
auto const ext = [&path]
{
auto const pos = path.rfind(".");
if(pos == beast::string_view::npos)
return beast::string_view{};
if(pos == boost::core::string_view::npos)
return boost::core::string_view{};
return path.substr(pos);
}();
if(iequals(ext, ".htm")) return "text/html";
Expand Down Expand Up @@ -79,8 +79,8 @@ mime_type(beast::string_view path)
// The returned path is normalized for the platform.
std::string
path_cat(
beast::string_view base,
beast::string_view path)
boost::core::string_view base,
boost::core::string_view path)
{
if(base.empty())
return std::string(path);
Expand Down Expand Up @@ -109,12 +109,12 @@ path_cat(
template <class Body, class Allocator>
http::message_generator
handle_request(
beast::string_view doc_root,
boost::core::string_view doc_root,
http::request<Body, http::basic_fields<Allocator>>&& req)
{
// Returns a bad request response
auto const bad_request =
[&req](beast::string_view why)
[&req](boost::core::string_view why)
{
http::response<http::string_body> res{http::status::bad_request, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -127,7 +127,7 @@ handle_request(

// Returns a not found response
auto const not_found =
[&req](beast::string_view target)
[&req](boost::core::string_view target)
{
http::response<http::string_body> res{http::status::not_found, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -140,7 +140,7 @@ handle_request(

// Returns a server error response
auto const server_error =
[&req](beast::string_view what)
[&req](boost::core::string_view what)
{
http::response<http::string_body> res{http::status::internal_server_error, req.version()};
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
Expand All @@ -159,7 +159,7 @@ handle_request(
// Request path must be absolute and not contain "..".
if( req.target().empty() ||
req.target()[0] != '/' ||
req.target().find("..") != beast::string_view::npos)
req.target().find("..") != boost::core::string_view::npos)
return bad_request("Illegal request-target");

// Build the path to the requested file
Expand Down
Loading