MCPcopy Create free account
hub / github.com/apache/trafficserver / decode_indexed_header_field

Function decode_indexed_header_field

src/proxy/http2/HPACK.cc:539–565  ·  view source on GitHub ↗

[RFC 7541] 6.1. Indexed Header Field Representation

Source from the content-addressed store, hash-verified

537// [RFC 7541] 6.1. Indexed Header Field Representation
538//
539int64_t
540decode_indexed_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start, const uint8_t *buf_end,
541 HpackIndexingTable &indexing_table)
542{
543 uint64_t index = 0;
544 int64_t len = 0;
545
546 len = xpack_decode_integer(index, buf_start, buf_end, 7);
547 if (len == XPACK_ERROR_COMPRESSION_ERROR) {
548 return HPACK_ERROR_COMPRESSION_ERROR;
549 }
550
551 if (indexing_table.get_header_field(index, header) == HPACK_ERROR_COMPRESSION_ERROR) {
552 return HPACK_ERROR_COMPRESSION_ERROR;
553 }
554
555 if (dbg_ctl_hpack_decode.on()) {
556 int decoded_name_len;
557 const char *decoded_name = header.name_get(&decoded_name_len);
558 int decoded_value_len;
559 const char *decoded_value = header.value_get(&decoded_value_len);
560
561 Dbg(dbg_ctl_hpack_decode, "Decoded field: %.*s: %.*s", decoded_name_len, decoded_name, decoded_value_len, decoded_value);
562 }
563
564 return len;
565}
566
567//
568// [RFC 7541] 6.2. Literal Header Field Representation

Callers 2

Calls 5

xpack_decode_integerFunction · 0.85
get_header_fieldMethod · 0.80
onMethod · 0.45
name_getMethod · 0.45
value_getMethod · 0.45

Tested by

no test coverage detected