-
Notifications
You must be signed in to change notification settings - Fork 48
HPACK Static & Dynamic Tables #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d7b5167
Initial HPACK impl
dislogical 4c1faab
Add integer decoding
dislogical 6a17e7f
Move hpack.h to private
dislogical 446f5d4
Nieve implementation of the static header table
dislogical 677ffff
Cleanups
dislogical d0cb0a1
Implement hpack dynamic table
dislogical f04df8e
table->context refactor
dislogical d63ca70
Static & Dynamic unit tests, bug fixes
dislogical d366781
Update hpack_encode_string
dislogical 8557e4e
Install aws-c-compression on CI
dislogical 991807c
Typo
dislogical 061f6c2
PR Feedback
dislogical d8f0de0
Fix the CI by un-fixing the CI
dislogical 411552b
Disable clang-format for the generated file
dislogical bbf29aa
Fix stupid cast that I wrote that's stupid
dislogical 3ced3eb
Unused parameter
dislogical 04666b6
Fatal assert on aws_hpack_static_table_init error
dislogical 1d97c48
Add integer decoding tests
dislogical c5b26ae
Add input and output rollback on failure w/tests
dislogical 9f66fed
AWS_FATAL_ASSERT -> assert(false)
dislogical 61972c6
Explicitly cast integer to uint8_t
dislogical File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #ifndef AWS_HTTP_HPACK_H | ||
| #define AWS_HTTP_HPACK_H | ||
|
|
||
| /* | ||
| * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| #include <aws/common/byte_buf.h> | ||
|
|
||
| AWS_EXTERN_C_BEGIN | ||
|
|
||
| struct aws_http_header; | ||
| struct aws_hpack_context; | ||
|
|
||
| /* Library-level init and shutdown */ | ||
| void aws_hpack_static_table_init(struct aws_allocator *allocator); | ||
| void aws_hpack_static_table_clean_up(void); | ||
|
|
||
| /* General HPACK API */ | ||
| struct aws_hpack_context *aws_hpack_context_new(struct aws_allocator *allocator, size_t max_dynamic_elements); | ||
| void aws_hpack_context_destroy(struct aws_hpack_context *context); | ||
| struct aws_http_header *aws_hpack_get_header(struct aws_hpack_context *context, size_t index); | ||
| int aws_hpack_find_index(struct aws_hpack_context *context, const struct aws_http_header *header, size_t *index); | ||
| int aws_hpack_insert_header(struct aws_hpack_context *context, const struct aws_http_header *header); | ||
| int aws_hpack_resize_dynamic_table(struct aws_hpack_context *context, size_t new_max_elements); | ||
|
|
||
| /* Public for testing purposes */ | ||
| int aws_hpack_encode_integer(uint64_t integer, uint8_t prefix_size, struct aws_byte_buf *output); | ||
| int aws_hpack_decode_integer(struct aws_byte_cursor *to_decode, uint8_t prefix_size, uint64_t *integer); | ||
dislogical marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| int aws_hpack_encode_string( | ||
| struct aws_hpack_context *context, | ||
| struct aws_byte_cursor *to_encode, | ||
| bool huffman_encode, | ||
| struct aws_byte_buf *output); | ||
|
|
||
| AWS_EXTERN_C_END | ||
|
|
||
| #endif /* AWS_HTTP_HPACK_H */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef HEADER | ||
| #error "Macro HEADER(index, name) must be defined before including this header file!" | ||
| #endif | ||
|
|
||
| #ifndef HEADER_WITH_VALUE | ||
| #error "Macro HEADER_WITH_VALUE(index, name, value) must be defined before including this header file!" | ||
| #endif | ||
|
|
||
| HEADER(1, ":authority") | ||
| HEADER_WITH_VALUE(2, ":method", "GET") | ||
| HEADER_WITH_VALUE(3, ":method", "POST") | ||
| HEADER_WITH_VALUE(4, ":path", "/") | ||
| HEADER_WITH_VALUE(5, ":path", "/index.html") | ||
| HEADER_WITH_VALUE(6, ":scheme", "http") | ||
| HEADER_WITH_VALUE(7, ":scheme", "https") | ||
| HEADER_WITH_VALUE(8, ":status", "200") | ||
| HEADER_WITH_VALUE(9, ":status", "204") | ||
| HEADER_WITH_VALUE(10, ":status", "206") | ||
| HEADER_WITH_VALUE(11, ":status", "304") | ||
| HEADER_WITH_VALUE(12, ":status", "400") | ||
| HEADER_WITH_VALUE(13, ":status", "404") | ||
| HEADER_WITH_VALUE(14, ":status", "500") | ||
| HEADER(15, "accept-charset") | ||
| HEADER_WITH_VALUE(16, "accept-encoding", "gzip,deflate") | ||
| HEADER(17, "accept-language") | ||
| HEADER(18, "accept-ranges") | ||
| HEADER(19, "accept") | ||
| HEADER(20, "access-control-allow-origin") | ||
| HEADER(21, "age") | ||
| HEADER(22, "allow") | ||
| HEADER(23, "authorization") | ||
| HEADER(24, "cache-control") | ||
| HEADER(25, "content-disposition") | ||
| HEADER(26, "content-encoding") | ||
| HEADER(27, "content-language") | ||
| HEADER(28, "content-length") | ||
| HEADER(29, "content-location") | ||
| HEADER(30, "content-range") | ||
| HEADER(31, "content-type") | ||
| HEADER(32, "cookie") | ||
| HEADER(33, "date") | ||
| HEADER(34, "etag") | ||
| HEADER(35, "expect") | ||
| HEADER(36, "expires") | ||
| HEADER(37, "from") | ||
| HEADER(38, "host") | ||
| HEADER(39, "if-match") | ||
| HEADER(40, "if-modified-since") | ||
| HEADER(41, "if-none-match") | ||
| HEADER(42, "if-range") | ||
| HEADER(43, "if-unmodified-since") | ||
| HEADER(44, "last-modified") | ||
| HEADER(45, "link") | ||
| HEADER(46, "location") | ||
| HEADER(47, "max-forwards") | ||
| HEADER(48, "proxy-authenticate") | ||
| HEADER(49, "proxy-authorization") | ||
| HEADER(50, "range") | ||
| HEADER(51, "referer") | ||
| HEADER(52, "refresh") | ||
| HEADER(53, "retry-after") | ||
| HEADER(54, "server") | ||
| HEADER(55, "set-cookie") | ||
| HEADER(56, "strict-transport-security") | ||
| HEADER(57, "transfer-encoding") | ||
| HEADER(58, "user-agent") | ||
| HEADER(59, "vary") | ||
| HEADER(60, "via") | ||
| HEADER(61, "www-authenticate") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.