Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions source/hpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ static bool s_header_eq(const void *a, const void *b) {
return aws_byte_cursor_eq(&left->value, &right->value);
}

static bool s_header_name_eq(const void *a, const void *b) {
const struct aws_byte_cursor *a_cursor = a;
const struct aws_byte_cursor *b_cursor = b;
return aws_byte_cursor_eq(a_cursor, b_cursor);
}

void aws_hpack_static_table_init(struct aws_allocator *allocator) {

int result = aws_hash_table_init(
Expand All @@ -86,7 +92,7 @@ void aws_hpack_static_table_init(struct aws_allocator *allocator) {
allocator,
s_static_header_table_size - 1,
aws_hash_byte_cursor_ptr,
(aws_hash_callback_eq_fn *)aws_byte_cursor_eq,
s_header_name_eq,
NULL,
NULL);
AWS_FATAL_ASSERT(AWS_OP_SUCCESS == result);
Expand Down Expand Up @@ -143,7 +149,7 @@ void aws_hpack_context_init(
allocator,
s_hpack_dynamic_table_initial_elements,
aws_hash_byte_cursor_ptr,
(aws_hash_callback_eq_fn *)aws_byte_cursor_eq,
s_header_name_eq,
NULL,
NULL);
}
Expand Down
14 changes: 13 additions & 1 deletion source/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ static void s_destroy_enum_value(void *value) {
aws_mem_release(enum_value->allocator, enum_value);
}

static bool s_str_array_eq_ignore_case(const void *a, const void *b) {
const struct aws_byte_cursor *a_cursor = a;
const struct aws_byte_cursor *b_cursor = b;
return aws_byte_cursor_eq_ignore_case(a_cursor, b_cursor);
}

static bool s_str_array_eq(const void *a, const void *b) {
const struct aws_byte_cursor *a_cursor = a;
const struct aws_byte_cursor *b_cursor = b;
return aws_byte_cursor_eq(a_cursor, b_cursor);
}

/**
* Given array of aws_byte_cursors, init hashtable where...
* Key is aws_byte_cursor* (pointing into cursor from array) and comparisons are case-insensitive.
Expand All @@ -215,7 +227,7 @@ static void s_init_str_to_enum_hash_table(
alloc,
end_index - start_index,
ignore_case ? aws_hash_byte_cursor_ptr_ignore_case : aws_hash_byte_cursor_ptr,
(aws_hash_callback_eq_fn *)(ignore_case ? aws_byte_cursor_eq_ignore_case : aws_byte_cursor_eq),
ignore_case ? s_str_array_eq_ignore_case : s_str_array_eq,
NULL,
s_destroy_enum_value);
AWS_FATAL_ASSERT(!err);
Expand Down