bneradt commented on code in PR #12679:
URL: https://github.com/apache/trafficserver/pull/12679#discussion_r2825461733
##########
src/proxy/http/HttpConfig.cc:
##########
@@ -694,6 +694,40 @@ const MgmtConverter HttpStatusCodeList::Conv{
}};
// clang-format on
+/////////////////////////////////////////////////////////////
+//
+// TargetedCacheControlHeaders implementation
+//
+/////////////////////////////////////////////////////////////
+
+void
+TargetedCacheControlHeaders::parse(std::string_view src)
+{
+ count = 0;
+ swoc::TextView config_view{src};
+
+ while (config_view && count < MAX_HEADERS) {
+ swoc::TextView header_name =
config_view.take_prefix_at(',').trim_if(&isspace);
+ if (!header_name.empty()) {
+ headers[count++] = std::string_view{header_name.data(),
header_name.size()};
+ }
+ }
+}
+
+// clang-format off
+const MgmtConverter TargetedCacheControlHeaders::Conv{
+ [](const void *data) -> std::string_view {
+ const TargetedCacheControlHeaders *hdrs = static_cast<const
TargetedCacheControlHeaders *>(data);
+ return hdrs->conf_value ? hdrs->conf_value : "";
+ },
+ [](void *data, std::string_view src) -> void {
+ TargetedCacheControlHeaders *hdrs =
static_cast<TargetedCacheControlHeaders *>(data);
+ // The string_views in headers[] point into conf_value, so conf_value must
+ // remain stable for the lifetime of the parsed headers.
+ hdrs->parse(src);
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]