1 #ifndef AWS_HTTP_IMPL_H
2 #define AWS_HTTP_IMPL_H
3 
4 /**
5  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
6  * SPDX-License-Identifier: Apache-2.0.
7  */
8 
9 #include <aws/http/http.h>
10 
11 /**
12  * Methods that affect internal processing.
13  * This is NOT a definitive list of methods.
14  */
15 enum aws_http_method {
16     AWS_HTTP_METHOD_UNKNOWN, /* Unrecognized value. */
17     AWS_HTTP_METHOD_GET,
18     AWS_HTTP_METHOD_HEAD,
19     AWS_HTTP_METHOD_CONNECT,
20     AWS_HTTP_METHOD_COUNT, /* Number of enums */
21 };
22 
23 /**
24  * Headers that affect internal processing.
25  * This is NOT a definitive list of headers.
26  */
27 enum aws_http_header_name {
28     AWS_HTTP_HEADER_UNKNOWN, /* Unrecognized value */
29 
30     /* Request pseudo-headers */
31     AWS_HTTP_HEADER_METHOD,
32     AWS_HTTP_HEADER_SCHEME,
33     AWS_HTTP_HEADER_AUTHORITY,
34     AWS_HTTP_HEADER_PATH,
35 
36     /* Response pseudo-headers */
37     AWS_HTTP_HEADER_STATUS,
38 
39     /* Regular headers */
40     AWS_HTTP_HEADER_CONNECTION,
41     AWS_HTTP_HEADER_CONTENT_LENGTH,
42     AWS_HTTP_HEADER_EXPECT,
43     AWS_HTTP_HEADER_TRANSFER_ENCODING,
44     AWS_HTTP_HEADER_COOKIE,
45     AWS_HTTP_HEADER_HOST,
46 
47     AWS_HTTP_HEADER_COUNT, /* Number of enums */
48 };
49 
50 AWS_EXTERN_C_BEGIN
51 
52 AWS_HTTP_API void aws_http_fatal_assert_library_initialized(void);
53 
54 AWS_HTTP_API struct aws_byte_cursor aws_http_version_to_str(enum aws_http_version version);
55 
56 /**
57  * Returns appropriate enum, or AWS_HTTP_METHOD_UNKNOWN if no match found.
58  * Case-sensitive
59  */
60 AWS_HTTP_API enum aws_http_method aws_http_str_to_method(struct aws_byte_cursor cursor);
61 
62 /**
63  * Returns appropriate enum, or AWS_HTTP_HEADER_UNKNOWN if no match found.
64  * Not case-sensitive
65  */
66 AWS_HTTP_API enum aws_http_header_name aws_http_str_to_header_name(struct aws_byte_cursor cursor);
67 
68 /**
69  * Returns appropriate enum, or AWS_HTTP_HEADER_UNKNOWN if no match found.
70  * Case-sensitive (ex: "Connection" -> AWS_HTTP_HEADER_UNKNOWN because we looked for "connection").
71  */
72 AWS_HTTP_API enum aws_http_header_name aws_http_lowercase_str_to_header_name(struct aws_byte_cursor cursor);
73 
74 AWS_EXTERN_C_END
75 
76 #endif /* AWS_HTTP_IMPL_H */
77