summaryrefslogtreecommitdiff
path: root/crow
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-03-05 04:35:53 +0300
committerEd Tanous <ed.tanous@intel.com>2019-03-07 00:53:46 +0300
commit39e77504ba0d1e8de273cd54e1f000166bfa6d0d (patch)
tree1dcb4a60df9460d8479db5282c5082058f4401fe /crow
parentf1eebf06f717d8561ff9bef2828c420ef051cb05 (diff)
downloadbmcweb-39e77504ba0d1e8de273cd54e1f000166bfa6d0d.tar.xz
bmcweb: /s/boost::string_view/std::string_view/g
With boost 1.69, we get the new option, BOOST_BEAST_USE_STD_STRING_VIEW which allows us to use std::string for all beast interfaces, instead of boost string_view. This was originally intended to try to reduce the binary size, but the comparison shows only a minor improvement. boost::string_view: 7420780 bytes std::string_view: 7419948 bytes 832 bytes saved ! ! ! ! ! So instead, we will use the argument that it's more standard and easier for people to grok. Tested By: Pulled down some bmcweb endpoints, and observed no change. Because the two objects are essentially drop in replacements for one another, there should be no change. Change-Id: I001e8cf2a0124de4792a7154bf246e3c35ef3f97 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'crow')
-rw-r--r--crow/include/crow/http_connection.h2
-rw-r--r--crow/include/crow/http_request.h10
-rw-r--r--crow/include/crow/http_response.h15
-rw-r--r--crow/include/crow/routing.h2
-rw-r--r--crow/include/crow/utility.h2
-rw-r--r--crow/include/crow/websocket.h2
6 files changed, 16 insertions, 17 deletions
diff --git a/crow/include/crow/http_connection.h b/crow/include/crow/http_connection.h
index f056f278e0..c02f4ec1e3 100644
--- a/crow/include/crow/http_connection.h
+++ b/crow/include/crow/http_connection.h
@@ -474,7 +474,7 @@ class Connection
// Compute the url parameters for the request
req->url = req->target();
std::size_t index = req->url.find("?");
- if (index != boost::string_view::npos)
+ if (index != std::string_view::npos)
{
req->url = req->url.substr(0, index);
}
diff --git a/crow/include/crow/http_request.h b/crow/include/crow/http_request.h
index 7de618ffdb..0ba02664de 100644
--- a/crow/include/crow/http_request.h
+++ b/crow/include/crow/http_request.h
@@ -13,7 +13,7 @@ namespace crow
struct Request
{
boost::beast::http::request<boost::beast::http::string_body>& req;
- boost::string_view url{};
+ std::string_view url{};
QueryString urlParams{};
bool isSecure{false};
@@ -32,22 +32,22 @@ struct Request
return req.method();
}
- const boost::string_view getHeaderValue(boost::string_view key) const
+ const std::string_view getHeaderValue(std::string_view key) const
{
return req[key];
}
- const boost::string_view getHeaderValue(boost::beast::http::field key) const
+ const std::string_view getHeaderValue(boost::beast::http::field key) const
{
return req[key];
}
- const boost::string_view methodString() const
+ const std::string_view methodString() const
{
return req.method_string();
}
- const boost::string_view target() const
+ const std::string_view target() const
{
return req.target();
}
diff --git a/crow/include/crow/http_response.h b/crow/include/crow/http_response.h
index 1deae34fbb..093bd90423 100644
--- a/crow/include/crow/http_response.h
+++ b/crow/include/crow/http_response.h
@@ -24,12 +24,12 @@ struct Response
nlohmann::json jsonValue;
- void addHeader(const boost::string_view key, const boost::string_view value)
+ void addHeader(const std::string_view key, const std::string_view value)
{
stringResponse->set(key, value);
}
- void addHeader(boost::beast::http::field key, boost::string_view value)
+ void addHeader(boost::beast::http::field key, std::string_view value)
{
stringResponse->set(key, value);
}
@@ -43,13 +43,12 @@ struct Response
{
}
- explicit Response(boost::string_view body_) :
- stringResponse(response_type{})
+ explicit Response(std::string_view body_) : stringResponse(response_type{})
{
stringResponse->body() = std::string(body_);
}
- Response(boost::beast::http::status code, boost::string_view s) :
+ Response(boost::beast::http::status code, std::string_view s) :
stringResponse(response_type{})
{
stringResponse->result(code);
@@ -94,7 +93,7 @@ struct Response
return stringResponse->result_int();
}
- boost::string_view reason()
+ std::string_view reason()
{
return stringResponse->reason();
}
@@ -132,7 +131,7 @@ struct Response
completed = false;
}
- void write(boost::string_view body_part)
+ void write(std::string_view body_part)
{
stringResponse->body() += std::string(body_part);
}
@@ -153,7 +152,7 @@ struct Response
}
}
- void end(boost::string_view body_part)
+ void end(std::string_view body_part)
{
write(body_part);
end();
diff --git a/crow/include/crow/routing.h b/crow/include/crow/routing.h
index 7ba5171158..746e115894 100644
--- a/crow/include/crow/routing.h
+++ b/crow/include/crow/routing.h
@@ -689,7 +689,7 @@ class Trie
}
std::pair<unsigned, RoutingParams>
- find(const boost::string_view req_url, const Node* node = nullptr,
+ find(const std::string_view req_url, const Node* node = nullptr,
unsigned pos = 0, RoutingParams* params = nullptr) const
{
RoutingParams empty;
diff --git a/crow/include/crow/utility.h b/crow/include/crow/utility.h
index 4bc7808945..a07c0415af 100644
--- a/crow/include/crow/utility.h
+++ b/crow/include/crow/utility.h
@@ -571,7 +571,7 @@ inline static std::string base64encodeUrlsafe(const char* data, size_t size)
// TODO this is temporary and should be deleted once base64 is refactored out of
// crow
-inline bool base64Decode(const boost::string_view input, std::string& output)
+inline bool base64Decode(const std::string_view input, std::string& output)
{
static const char nop = -1;
// See note on encoding_data[] in above function
diff --git a/crow/include/crow/websocket.h b/crow/include/crow/websocket.h
index 6ce7e05a68..6901eb108f 100644
--- a/crow/include/crow/websocket.h
+++ b/crow/include/crow/websocket.h
@@ -73,7 +73,7 @@ template <typename Adaptor> class ConnectionImpl : public Connection
{
BMCWEB_LOG_DEBUG << "starting connection " << this;
- boost::string_view protocol = req.getHeaderValue(
+ std::string_view protocol = req.getHeaderValue(
boost::beast::http::field::sec_websocket_protocol);
// Perform the websocket upgrade