bneradt commented on code in PR #12679:
URL: https://github.com/apache/trafficserver/pull/12679#discussion_r2547529577
##########
src/proxy/hdrs/MIME.cc:
##########
@@ -3723,13 +3724,34 @@ MIMEHdrImpl::recompute_cooked_stuff(MIMEField
*changing_field_or_null)
mime_hdr_cooked_stuff_init(this, changing_field_or_null);
- //////////////////////////////////////////////////
- // (1) cook the Cache-Control header if present //
- //////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////////////////
+ // (1) cook the Cache-Control header (or targeted variant) if present //
+ /////////////////////////////////////////////////////////////////////////////
// to be safe, recompute unless you know this call is for other cooked field
if ((changing_field_or_null == nullptr) ||
(changing_field_or_null->m_wks_idx != MIME_WKSIDX_PRAGMA)) {
- field = mime_hdr_field_find(this,
static_cast<std::string_view>(MIME_FIELD_CACHE_CONTROL));
+ field = nullptr;
+
+ // Check for targeted cache control headers first (in priority order).
+ if (targeted_headers_str && *targeted_headers_str) {
+ swoc::TextView config_view{targeted_headers_str};
+ while (config_view) {
+ swoc::TextView header_name =
config_view.take_prefix_at(',').trim_if(&isspace);
+ if (!header_name.empty()) {
+ field = mime_hdr_field_find(this,
std::string_view{header_name.data(), header_name.size()});
+ if (field) {
+ // Found a targeted header! Mark it and stop searching.
+ m_cooked_stuff.m_cache_control.m_from_targeted_header = true;
+ break;
+ }
+ }
+ }
+ }
+
+ // If no targeted header was found, fall back to standard Cache-Control.
+ if (!field) {
+ field = mime_hdr_field_find(this,
static_cast<std::string_view>(MIME_FIELD_CACHE_CONTROL));
+ }
Review Comment:
This is the actualy interesting production change (part 1).
--
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]