mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 05:17:26 +02:00
Fixes to rfc7230:
fix #1435, fix #1438 * Example and test can be built on msvc v141 15.9.6 using /std:c++17 and BOOST_BEAST_USE_STD_STRING_VIEW. * changed string_view.to_string() to std:string(string_view), awaiting availability of Library Fundamentals TS here. * Reactivated relevant tests to param_list. #ifdef 0 test exhibited same assertion failed error in debug mode. Now fixed in DEBUG on msvc v141 15.9.6 with BOOST_BEAST_USE_STD_STRING_VIEW and /std:c++17. * Looked up http paramters (transfer-encoding, etc.) and changed tests as well as fixing comment to match specs.
This commit is contained in:
committed by
Vinnie Falco
parent
55d319a9d9
commit
cd28598e5b
@ -6,6 +6,7 @@ Version 211:
|
|||||||
* Add flat_stream
|
* Add flat_stream
|
||||||
* flat_buffer::clear preserves capacity
|
* flat_buffer::clear preserves capacity
|
||||||
* multi_buffer::clear preserves capacity
|
* multi_buffer::clear preserves capacity
|
||||||
|
* Fixes to rfc7230
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -129,7 +129,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -142,7 +142,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -155,7 +155,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -83,8 +83,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -123,7 +123,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -136,7 +136,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -149,7 +149,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -60,8 +60,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -100,7 +100,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -113,7 +113,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -126,7 +126,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -339,7 +339,7 @@ void do_server_head(
|
|||||||
// we do not recognize the request method.
|
// we do not recognize the request method.
|
||||||
res.result(status::bad_request);
|
res.result(status::bad_request);
|
||||||
res.set(field::content_type, "text/plain");
|
res.set(field::content_type, "text/plain");
|
||||||
res.body() = "Invalid request-method '" + req.method_string().to_string() + "'";
|
res.body() = "Invalid request-method '" + std::string(req.method_string()) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -122,7 +122,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -135,7 +135,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -148,7 +148,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -78,8 +78,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -118,7 +118,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -131,7 +131,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -144,7 +144,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -80,8 +80,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -120,7 +120,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -133,7 +133,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -146,7 +146,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -76,8 +76,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -116,7 +116,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -129,7 +129,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -142,7 +142,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -196,7 +196,7 @@ private:
|
|||||||
// we do not recognize the request method.
|
// we do not recognize the request method.
|
||||||
send_bad_response(
|
send_bad_response(
|
||||||
http::status::bad_request,
|
http::status::bad_request,
|
||||||
"Invalid request-method '" + req.method_string().to_string() + "'\r\n");
|
"Invalid request-method '" + std::string(req.method_string()) + "'\r\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ private:
|
|||||||
file_response_->result(http::status::ok);
|
file_response_->result(http::status::ok);
|
||||||
file_response_->keep_alive(false);
|
file_response_->keep_alive(false);
|
||||||
file_response_->set(http::field::server, "Beast");
|
file_response_->set(http::field::server, "Beast");
|
||||||
file_response_->set(http::field::content_type, mime_type(target.to_string()));
|
file_response_->set(http::field::content_type, mime_type(std::string(target)));
|
||||||
file_response_->body() = std::move(file);
|
file_response_->body() = std::move(file);
|
||||||
file_response_->prepare_payload();
|
file_response_->prepare_payload();
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -122,7 +122,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -135,7 +135,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -148,7 +148,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -119,7 +119,7 @@ private:
|
|||||||
response_.set(http::field::content_type, "text/plain");
|
response_.set(http::field::content_type, "text/plain");
|
||||||
beast::ostream(response_.body())
|
beast::ostream(response_.body())
|
||||||
<< "Invalid request-method '"
|
<< "Invalid request-method '"
|
||||||
<< request_.method_string().to_string()
|
<< std::string(request_.method_string())
|
||||||
<< "'";
|
<< "'";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -123,7 +123,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -136,7 +136,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -149,7 +149,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -79,8 +79,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -119,7 +119,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -132,7 +132,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -145,7 +145,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -77,8 +77,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -117,7 +117,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -130,7 +130,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -143,7 +143,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -74,9 +74,9 @@ path_cat(
|
|||||||
beast::string_view base,
|
beast::string_view base,
|
||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if (base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -115,7 +115,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -128,7 +128,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -141,7 +141,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -60,8 +60,8 @@ path_cat(
|
|||||||
beast::string_view path)
|
beast::string_view path)
|
||||||
{
|
{
|
||||||
if(base.empty())
|
if(base.empty())
|
||||||
return path.to_string();
|
return std::string(path);
|
||||||
std::string result = base.to_string();
|
std::string result(base);
|
||||||
#if BOOST_MSVC
|
#if BOOST_MSVC
|
||||||
char constexpr path_separator = '\\';
|
char constexpr path_separator = '\\';
|
||||||
if(result.back() == path_separator)
|
if(result.back() == path_separator)
|
||||||
@ -100,7 +100,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = why.to_string();
|
res.body() = std::string(why);
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -113,7 +113,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "The resource '" + target.to_string() + "' was not found.";
|
res.body() = "The resource '" + std::string(target) + "' was not found.";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -126,7 +126,7 @@ handle_request(
|
|||||||
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
res.set(http::field::server, BOOST_BEAST_VERSION_STRING);
|
||||||
res.set(http::field::content_type, "text/html");
|
res.set(http::field::content_type, "text/html");
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
res.body() = "An error occurred: '" + what.to_string() + "'";
|
res.body() = "An error occurred: '" + std::string(what) + "'";
|
||||||
res.prepare_payload();
|
res.prepare_payload();
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
@ -316,7 +316,7 @@ increment()
|
|||||||
param-list = *( OWS ";" OWS param )
|
param-list = *( OWS ";" OWS param )
|
||||||
param = token OWS "=" OWS ( token / quoted-string )
|
param = token OWS "=" OWS ( token / quoted-string )
|
||||||
|
|
||||||
chunked;a=b;i=j,gzip;windowBits=12
|
chunked;a=b;i=j;gzip;windowBits=12
|
||||||
x,y
|
x,y
|
||||||
,,,,,chameleon
|
,,,,,chameleon
|
||||||
*/
|
*/
|
||||||
@ -350,6 +350,8 @@ increment()
|
|||||||
}
|
}
|
||||||
v_.first = string_view{&*p0,
|
v_.first = string_view{&*p0,
|
||||||
static_cast<std::size_t>(it_ - p0)};
|
static_cast<std::size_t>(it_ - p0)};
|
||||||
|
if (it_ == last_)
|
||||||
|
return;
|
||||||
detail::param_iter pi;
|
detail::param_iter pi;
|
||||||
pi.it = it_;
|
pi.it = it_;
|
||||||
pi.first = it_;
|
pi.first = it_;
|
||||||
|
@ -1152,7 +1152,7 @@ public:
|
|||||||
"HTTP/1.1 200 OK\r\n"
|
"HTTP/1.1 200 OK\r\n"
|
||||||
"Transfer-Encoding: chunked\r\n"
|
"Transfer-Encoding: chunked\r\n"
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"0" + s.to_string() + "\r\n"
|
"0" + std::string(s) + "\r\n"
|
||||||
"\r\n";
|
"\r\n";
|
||||||
error_code ec;
|
error_code ec;
|
||||||
test_parser<false> p;
|
test_parser<false> p;
|
||||||
@ -1169,7 +1169,7 @@ public:
|
|||||||
"HTTP/1.1 200 OK\r\n"
|
"HTTP/1.1 200 OK\r\n"
|
||||||
"Transfer-Encoding: chunked\r\n"
|
"Transfer-Encoding: chunked\r\n"
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"0" + s.to_string() + "\r\n"
|
"0" + std::string(s) + "\r\n"
|
||||||
"\r\n";
|
"\r\n";
|
||||||
error_code ec;
|
error_code ec;
|
||||||
test_parser<false> p;
|
test_parser<false> p;
|
||||||
|
@ -195,11 +195,11 @@ public:
|
|||||||
std::string s;
|
std::string s;
|
||||||
for(auto const& v : ce)
|
for(auto const& v : ce)
|
||||||
{
|
{
|
||||||
s.append(v.first.to_string());
|
s.append(std::string(v.first));
|
||||||
s.push_back(',');
|
s.push_back(',');
|
||||||
if(! v.second.empty())
|
if(! v.second.empty())
|
||||||
{
|
{
|
||||||
s.append(v.second.to_string());
|
s.append(std::string(v.second));
|
||||||
s.push_back(',');
|
s.push_back(',');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ public:
|
|||||||
bool get_keep_alive_impl(unsigned) const { return true; }
|
bool get_keep_alive_impl(unsigned) const { return true; }
|
||||||
bool has_content_length_impl() const { return false; }
|
bool has_content_length_impl() const { return false; }
|
||||||
void set_method_impl(string_view) {}
|
void set_method_impl(string_view) {}
|
||||||
void set_target_impl(string_view s) { target = s.to_string(); }
|
void set_target_impl(string_view s) { target = std::string(s); }
|
||||||
void set_reason_impl(string_view) {}
|
void set_reason_impl(string_view) {}
|
||||||
void set_chunked_impl(bool) {}
|
void set_chunked_impl(bool) {}
|
||||||
void set_content_length_impl(boost::optional<std::uint64_t>) {}
|
void set_content_length_impl(boost::optional<std::uint64_t>) {}
|
||||||
|
@ -88,6 +88,9 @@ public:
|
|||||||
cq("\t; \t xyz=1 ; ijk=\"q\\\"t\"", ";xyz=1;ijk=q\"t");
|
cq("\t; \t xyz=1 ; ijk=\"q\\\"t\"", ";xyz=1;ijk=q\"t");
|
||||||
ce(";x;y");
|
ce(";x;y");
|
||||||
|
|
||||||
|
ce(";chunked;a=b;i=j;gzip;windowBits=12");
|
||||||
|
ce(";chunked;a=b;i=j;gzip;windowBits=12;permessage-deflate");
|
||||||
|
|
||||||
// invalid strings
|
// invalid strings
|
||||||
cs(";", "");
|
cs(";", "");
|
||||||
cs(";,", "");
|
cs(";,", "");
|
||||||
@ -96,6 +99,7 @@ public:
|
|||||||
cq(";xy=\"\x7f", "");
|
cq(";xy=\"\x7f", "");
|
||||||
cq(";xy=\"\\", "");
|
cq(";xy=\"\\", "");
|
||||||
cq(";xy=\"\\\x01\"", "");
|
cq(";xy=\"\\\x01\"", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -344,11 +348,9 @@ public:
|
|||||||
run()
|
run()
|
||||||
{
|
{
|
||||||
testOptTokenList();
|
testOptTokenList();
|
||||||
#if 0
|
|
||||||
testParamList();
|
testParamList();
|
||||||
testExtList();
|
testExtList();
|
||||||
testTokenList();
|
testTokenList();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
fc_->fail(ec);
|
fc_->fail(ec);
|
||||||
else
|
else
|
||||||
ec = {};
|
ec = {};
|
||||||
fields[name.to_string()] = value.to_string();
|
fields[std::string(name)] = std::string(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -295,7 +295,7 @@ public:
|
|||||||
write(ts, m, ec);
|
write(ts, m, ec);
|
||||||
if(ec && ec != error::end_of_stream)
|
if(ec && ec != error::end_of_stream)
|
||||||
BOOST_THROW_EXCEPTION(system_error{ec});
|
BOOST_THROW_EXCEPTION(system_error{ec});
|
||||||
return tr.str().to_string();
|
return std::string(tr.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user