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

Method decode

src/proxy/http3/QPACK.cc:270–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270int
271QPACK::decode(uint64_t stream_id, const uint8_t *header_block, size_t header_block_len, HTTPHdr &hdr, Continuation *cont,
272 EThread *thread)
273{
274 if (!cont || !header_block) {
275 return -1;
276 }
277
278 if (this->_invalid) {
279 thread->schedule_imm(cont, QPACK_EVENT_DECODE_FAILED, nullptr);
280 return -1;
281 }
282
283 uint64_t tmp = 0;
284 int64_t ret = xpack_decode_integer(tmp, header_block, header_block + header_block_len, 8);
285 if (ret < 0 && tmp > 0xFFFF) {
286 return -1;
287 }
288 uint16_t largest_reference = tmp;
289
290 if (largest_reference != 0 && (this->_dynamic_table.is_empty() || this->_dynamic_table.largest_index() < largest_reference)) {
291 // Blocked
292 if (this->_add_to_blocked_list(
293 new DecodeRequest(largest_reference, thread, cont, stream_id, header_block, header_block_len, hdr))) {
294 return 1;
295 } else {
296 // Number of blocked streams exceed the limit
297 return -2;
298 }
299 }
300
301 this->_decode(thread, cont, stream_id, header_block, header_block_len, hdr);
302
303 return 0;
304}
305
306void
307QPACK::set_encoder_stream(QUICStreamId id)

Callers 2

handle_frameMethod · 0.45
test_decodeFunction · 0.45

Calls 6

_add_to_blocked_listMethod · 0.95
_decodeMethod · 0.95
xpack_decode_integerFunction · 0.85
largest_indexMethod · 0.80
schedule_immMethod · 0.45
is_emptyMethod · 0.45

Tested by 1

test_decodeFunction · 0.36