bneradt commented on code in PR #13455:
URL: https://github.com/apache/trafficserver/pull/13455#discussion_r3908255667
##########
src/proxy/hdrs/MIME.cc:
##########
@@ -1361,10 +1407,59 @@ mime_field_create(HdrHeap *heap, MIMEHdrImpl *mh)
return field;
}
+MIMEField *
+mime_field_create_for_name(HdrHeap *heap, MIMEHdrImpl *mh, std::string_view
name)
+{
+ if (mh->m_fblock_list_tail->m_freetop < MIME_FIELD_BLOCK_SLOTS) {
+ return mime_field_create(heap, mh);
+ }
+
+ int last_dup_slot = -1;
+
+ if (MIMEField *last_dup = name.empty() ? nullptr : mime_hdr_field_find(mh,
name); last_dup != nullptr) {
+ while (last_dup->m_next_dup != nullptr) {
+ last_dup = last_dup->m_next_dup;
+ }
+ last_dup_slot = mime_hdr_field_slotnum(mh, last_dup);
+ ink_release_assert(last_dup_slot >= 0);
+ }
+
+ if (mh->m_free_slot == MIME_FIELD_FREE_SLOT_UNINITIALIZED) {
Review Comment:
Implemented in `5d91d73dbc`. The free list is now rebuilt before any name
lookup, and an empty result returns directly to normal block allocation. That
avoids both `mime_hdr_field_find()` and the duplicate-chain walk when no
reusable slot exists.
Validated with a full configure/format/build/install in `asfats5`, the
focused MIME slot-reuse test (29 assertions), and the HPACK regression
executable.
--
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]