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

Function output_encoded_data

src/proxy/http3/test/test_QPACK.cc:183–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void
184output_encoded_data(FILE *fd, uint64_t stream_id, IOBufferReader *header_block_reader)
185{
186 uint8_t buf[1024];
187
188 // Write StreamId
189 stream_id = htobe64(stream_id);
190 fwrite(reinterpret_cast<uint8_t *>(&stream_id), 8, 1, fd);
191
192 // Skip 32 bits for Length
193 fseek(fd, 4, SEEK_CUR);
194
195 // Write QPACKData
196 int64_t total, nread;
197 total = 0;
198 while ((nread = header_block_reader->read(buf, sizeof(buf))) > 0) {
199 fwrite(buf, nread, 1, fd);
200 total += nread;
201 }
202
203 // Back to the position for Length
204 fseek(fd, -(total + 4), SEEK_CUR);
205
206 // Write Length
207 uint32_t len = htobe32(total);
208 fwrite(reinterpret_cast<uint8_t *>(&len), 4, 1, fd);
209
210 // Back to the tail
211 fseek(fd, 0, SEEK_END);
212}
213
214void
215output_decoded_headers(FILE *fd, HTTPHdr **headers, uint64_t n)

Callers 1

test_encodeFunction · 0.85

Calls 3

htobe64Function · 0.85
htobe32Function · 0.85
readMethod · 0.45

Tested by

no test coverage detected