| 181 | } |
| 182 | |
| 183 | void |
| 184 | output_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 | |
| 214 | void |
| 215 | output_decoded_headers(FILE *fd, HTTPHdr **headers, uint64_t n) |
no test coverage detected