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

Method _on_qpack_decode_complete

src/proxy/http3/Http3HeaderVIOAdaptor.cc:103–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103int
104Http3HeaderVIOAdaptor::_on_qpack_decode_complete()
105{
106 // Currently trailer support for h3 is not implemented.
107 constexpr static bool NON_TRAILER = false;
108 if (!HeaderValidator::is_h2_h3_header_valid(this->_header, http_hdr_type_get(this->_header.m_http) == HTTP_TYPE_RESPONSE,
109 NON_TRAILER)) {
110 Dbg(dbg_ctl_http3, "Header is invalid");
111 return -1;
112 }
113 int res = this->_hvc.convert(this->_header, 3, 1);
114 if (res != 0) {
115 Dbg(dbg_ctl_http3, "PARSE_RESULT_ERROR");
116 return -1;
117 }
118
119 // FIXME: response header might be delayed from first response body because of callback from QPACK
120 // Workaround fix for mixed response header and body
121 if (http_hdr_type_get(this->_header.m_http) == HTTP_TYPE_RESPONSE) {
122 return 0;
123 }
124
125 SCOPED_MUTEX_LOCK(lock, this->_sink_vio->mutex, this_ethread());
126 MIOBuffer *writer = this->_sink_vio->get_writer();
127
128 // TODO: Http2Stream::send_request has same logic. It originally comes from HttpSM::write_header_into_buffer.
129 // a). Make HttpSM::write_header_into_buffer static
130 // or
131 // b). Add interface to HTTPHdr to dump data
132 // or
133 // c). Add interface to HttpSM to handle HTTPHdr directly
134 int bufindex;
135 int dumpoffset = 0;
136 int done, tmp;
137 IOBufferBlock *block;
138 do {
139 bufindex = 0;
140 tmp = dumpoffset;
141 block = writer->get_current_block();
142 if (!block) {
143 writer->add_block();
144 block = writer->get_current_block();
145 }
146 done = this->_header.print(block->end(), block->write_avail(), &bufindex, &tmp);
147 dumpoffset += bufindex;
148 writer->fill(bufindex);
149 if (!done) {
150 writer->add_block();
151 }
152 } while (!done);
153
154 this->_is_complete = true;
155 return 1;
156}

Callers 1

event_handlerMethod · 0.95

Calls 10

http_hdr_type_getFunction · 0.85
this_ethreadFunction · 0.85
get_writerMethod · 0.80
get_current_blockMethod · 0.80
convertMethod · 0.45
add_blockMethod · 0.45
printMethod · 0.45
endMethod · 0.45
write_availMethod · 0.45
fillMethod · 0.45

Tested by

no test coverage detected