-
Notifications
You must be signed in to change notification settings - Fork 852
Implement RFC 9213 Targeted HTTP Cache Control #12679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3713,7 +3713,8 @@ MIMEHdrImpl::recompute_accelerators_and_presence_bits() | |||||||||||
| //////////////////////////////////////////////////////// | ||||||||||||
|
|
||||||||||||
| void | ||||||||||||
| MIMEHdrImpl::recompute_cooked_stuff(MIMEField *changing_field_or_null) | ||||||||||||
| MIMEHdrImpl::recompute_cooked_stuff(MIMEField *changing_field_or_null, const std::string_view *targeted_headers, | ||||||||||||
| size_t targeted_headers_count) | ||||||||||||
| { | ||||||||||||
| int len, tlen; | ||||||||||||
| const char *s; | ||||||||||||
|
|
@@ -3725,13 +3726,26 @@ 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). | ||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assert that targeted_headers is non-nullptr. |
||||||||||||
| for (size_t i = 0; i < targeted_headers_count; ++i) { | ||||||||||||
| field = mime_hdr_field_find(this, targeted_headers[i]); | ||||||||||||
| if (field) { | ||||||||||||
| break; | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // If no targeted header was found, fall back to standard Cache-Control. | ||||||||||||
| if (!field) { | ||||||||||||
|
Comment on lines
+3745
to
+3746
|
||||||||||||
| // If no targeted header was found, fall back to standard Cache-Control. | |
| if (!field) { | |
| // If no targeted header was found, fall back to standard Cache-Control | |
| // only when no targeted headers were requested. | |
| if (!field && (targeted_headers_count == 0 || targeted_headers == nullptr)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actualy interesting production change (part 1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we don't do this consistently, but if the copy constructor / assignment constructor shouldn't be used (seems iffy with the raw pointer), should we = delete; them here ?