| 411 | } |
| 412 | |
| 413 | Http2ErrorCode |
| 414 | http2_encode_header_blocks(HTTPHdr *in, uint8_t *out, uint32_t out_len, uint32_t *len_written, HpackHandle &handle, |
| 415 | int32_t maximum_table_size) |
| 416 | { |
| 417 | // Limit the maximum table size to the configured value or 64kB at maximum, which is the size advertised by major clients |
| 418 | maximum_table_size = |
| 419 | std::min(maximum_table_size, static_cast<int32_t>(std::min(Http2::header_table_size_limit, HTTP2_MAX_TABLE_SIZE_LIMIT))); |
| 420 | // Set maximum table size only if it is different from current maximum size |
| 421 | if (maximum_table_size == hpack_get_maximum_table_size(handle)) { |
| 422 | maximum_table_size = -1; |
| 423 | } |
| 424 | |
| 425 | // TODO: It would be better to split Cookie header value |
| 426 | int64_t result = hpack_encode_header_block(handle, out, out_len, in, maximum_table_size); |
| 427 | if (result < 0) { |
| 428 | return Http2ErrorCode::HTTP2_ERROR_COMPRESSION_ERROR; |
| 429 | } |
| 430 | if (len_written) { |
| 431 | *len_written = result; |
| 432 | } |
| 433 | return Http2ErrorCode::HTTP2_ERROR_NO_ERROR; |
| 434 | } |
| 435 | |
| 436 | /* |
| 437 | * Decode Header Blocks to Header List. |
no test coverage detected