Skip to content
Merged
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
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
$<INSTALL_INTERFACE:include>)

find_package(aws-c-io REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC AWS::aws-c-io)
find_package(aws-c-compression REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC AWS::aws-c-io AWS::aws-c-compression)

aws_prepare_shared_lib_exports(${CMAKE_PROJECT_NAME})

Expand Down
1 change: 1 addition & 0 deletions codebuild/common-posix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if [ "$TRAVIS_OS_NAME" != "osx" ]; then
fi
install_library aws-c-common
install_library aws-c-io
install_library aws-c-compression

mkdir -p build
pushd build
Expand Down
1 change: 1 addition & 0 deletions codebuild/common-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ mkdir %INSTALL_DIR%

CALL :install_library aws-c-common
CALL :install_library aws-c-io
CALL :install_library aws-c-compression

mkdir %BUILDS_DIR%\aws-c-http-build
cd %BUILDS_DIR%\aws-c-http-build
Expand Down
49 changes: 49 additions & 0 deletions include/aws/http/private/hpack.h
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);
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 */
84 changes: 84 additions & 0 deletions include/aws/http/private/hpack_header_static_table.def
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")
Loading