Github user maskit commented on a diff in the pull request: https://github.com/apache/trafficserver/pull/391#discussion_r48617340 --- Diff: proxy/http2/HPACK.cc --- @@ -263,12 +263,80 @@ Http2DynamicTable::add_header_field(const MIMEField *field) } MIMEField *new_field = _mhdr->field_create(name, name_len); + new_field->name_set(_mhdr->m_heap, _mhdr->m_mime, name, name_len); new_field->value_set(_mhdr->m_heap, _mhdr->m_mime, value, value_len); + mime_hdr_field_attach(_mhdr->m_mime, new_field, 1, NULL); // XXX Because entire Vec instance is copied, Its too expensive! _headers.insert(0, new_field); } } +uint32_t +Http2DynamicTable::get_dynamic_table_size() const +{ + return _current_size; +} + +Http2LookupIndexResult +Http2DynamicTable::get_index(const MIMEFieldWrapper &field) const +{ + Http2LookupIndexResult result; + int target_name_len = 0, target_value_len = 0; + const char *target_name = field.name_get(&target_name_len); + const char *target_value = field.value_get(&target_value_len); + const int entry_num = TS_HPACK_STATIC_TABLE_ENTRY_NUM + get_current_entry_num(); + + for (int index = 1; index < entry_num; ++index) { + const char *table_name, *table_value; + int table_name_len = 0, table_value_len = 0; + + if (index < TS_HPACK_STATIC_TABLE_ENTRY_NUM) { + // static table + table_name = STATIC_TABLE[index].name; + table_value = STATIC_TABLE[index].value; + table_name_len = strlen(table_name); + table_value_len = strlen(table_value); + } else { + // dynamic table + const MIMEField *m_field = get_header(index - TS_HPACK_STATIC_TABLE_ENTRY_NUM + 1); + table_name = m_field->name_get(&table_name_len); + table_value = m_field->value_get(&table_value_len); + } + + // Check whether name (and value) are matched + if (ptr_len_casecmp(target_name, target_name_len, table_name, table_name_len) == 0) { + if (ptr_len_casecmp(target_value, target_value_len, table_value, table_value_len) == 0) { --- End diff -- At least values must be compared with case sensitive.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---