You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/02/01 22:55:36 UTC

[GitHub] [trafficserver] masaori335 commented on a change in pull request #6520: Cleanup: Get rid of MIMEFieldWrapper from HPACK encoding

masaori335 commented on a change in pull request #6520:
URL: https://github.com/apache/trafficserver/pull/6520#discussion_r568199436



##########
File path: proxy/http2/HPACK.cc
##########
@@ -227,19 +223,18 @@ hpack_parse_field_type(uint8_t ftype)
 namespace HpackStaticTable
 {
   HpackLookupResult
-  lookup(const char *name, int name_len, const char *value, int value_len)
+  lookup(const HpackHeaderField &header)
   {
     HpackLookupResult result;
 
     for (unsigned int index = 1; index < TS_HPACK_STATIC_TABLE_ENTRY_NUM; ++index) {
-      const char *table_name  = STATIC_TABLE[index].name;
-      int table_name_len      = STATIC_TABLE[index].name_size;
-      const char *table_value = STATIC_TABLE[index].value;
-      int table_value_len     = STATIC_TABLE[index].value_size;
+      std::string_view name  = STATIC_TABLE[index].name;
+      std::string_view value = STATIC_TABLE[index].value;
 
+      // TODO: replace `strcasecmp` with `memcmp`
       // Check whether name (and value) are matched
-      if (ptr_len_casecmp(name, name_len, table_name, table_name_len) == 0) {
-        if ((value_len == table_value_len) && (memcmp(value, table_value, value_len) == 0)) {
+      if (strcasecmp(header.name, name) == 0) {
+        if (header.value.size() == value.size() && memcmp(header.value.data(), value.data(), value.size()) == 0) {

Review comment:
       I completely forgot about `memcmp` in `TextView.h`.  Will call it.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org