Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
724b67d
pesudo headers begin
TingDaoK Aug 9, 2021
ad2a446
response part
TingDaoK Aug 9, 2021
3b06a97
headers
TingDaoK Aug 11, 2021
aa47b59
transform headers
TingDaoK Aug 11, 2021
e9c9ad8
Merge branch 'h2_message_main' into h2_message
TingDaoK Sep 28, 2021
1eb4851
talked and changed design
TingDaoK Sep 28, 2021
50b7109
I'll put version into the message instead
TingDaoK Sep 29, 2021
0b2799d
comments addressed
TingDaoK Oct 4, 2021
09bd454
make it build
TingDaoK Oct 4, 2021
7b0012b
use the end index instead.
TingDaoK Oct 4, 2021
1e0f555
add pseudo to the front
TingDaoK Oct 4, 2021
1dd13fe
Revert "use the end index instead."
TingDaoK Oct 4, 2021
1a98cb9
Merge branch 'h2_message' into h2_message_imp
TingDaoK Oct 4, 2021
0f1734e
that's a bug..
TingDaoK Oct 4, 2021
be83942
Merge branch 'h2_message' into h2_message_imp
TingDaoK Oct 4, 2021
f6d7de6
impl of set
TingDaoK Oct 4, 2021
1f5f90d
add test and missed one function
TingDaoK Oct 4, 2021
be6dbc6
Changed mind
TingDaoK Oct 4, 2021
c54cc19
doc update
TingDaoK Oct 4, 2021
49685f3
response document
TingDaoK Oct 4, 2021
c5403a1
http message support h2 headers
TingDaoK Oct 13, 2021
652aeeb
not belong to this PR
TingDaoK Oct 13, 2021
f1d34fd
We also need a helper to get the version fo the message
TingDaoK Oct 14, 2021
2a2c6c8
http2 message new
TingDaoK Oct 15, 2021
d4603a3
Merge branch 'h2_message_main' into h2_message
TingDaoK Oct 15, 2021
ccd8bc1
comments addressed
TingDaoK Oct 20, 2021
9fdc5cb
only push front when needed
TingDaoK Oct 26, 2021
1c5e8df
behavior change
TingDaoK Oct 26, 2021
f0a7ade
Merge branch 'main' into h2_message
TingDaoK Oct 26, 2021
fbec12b
address comments
TingDaoK Oct 27, 2021
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
6 changes: 6 additions & 0 deletions include/aws/http/private/strutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,11 @@ bool aws_strutil_is_http_reason_phrase(struct aws_byte_cursor cursor);
AWS_HTTP_API
bool aws_strutil_is_http_request_target(struct aws_byte_cursor cursor);

/**
* Return whether this ASCII/UTF-8 sequence start with ":" or not as the requirement for pseudo headers.
*/
AWS_HTTP_API
bool aws_strutil_is_http_pseudo_header_name(struct aws_byte_cursor cursor);

AWS_EXTERN_C_END
#endif /* AWS_HTTP_STRUTIL_H */
99 changes: 97 additions & 2 deletions include/aws/http/request_response.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,77 @@ AWS_HTTP_API
void aws_http_headers_clear(struct aws_http_headers *headers);

/**
* Create a new request message.
* Get the `:method` value (HTTP/2 headers only).
*/
AWS_HTTP_API
int aws_http2_headers_get_request_method(const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_method);

/**
* Set `:method` (HTTP/2 headers only).
* The headers makes its own copy of the underlying string.
*/
AWS_HTTP_API
int aws_http2_headers_set_request_method(struct aws_http_headers *h2_headers, struct aws_byte_cursor method);

/*
* Get the `:scheme` value (HTTP/2 headers only).
*/
AWS_HTTP_API
int aws_http2_headers_get_request_scheme(const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_scheme);

/**
* Set `:scheme` (request pseudo headers only).
* The pseudo headers makes its own copy of the underlying string.
*/
AWS_HTTP_API
int aws_http2_headers_set_request_scheme(struct aws_http_headers *h2_headers, struct aws_byte_cursor scheme);

/*
* Get the `:authority` value (request pseudo headers only).
*/
AWS_HTTP_API
int aws_http2_headers_get_request_authority(
const struct aws_http_headers *h2_headers,
struct aws_byte_cursor *out_authority);

/**
* Set `:authority` (request pseudo headers only).
* The pseudo headers makes its own copy of the underlying string.
*/
AWS_HTTP_API
int aws_http2_headers_set_request_authority(struct aws_http_headers *h2_headers, struct aws_byte_cursor authority);

/*
* Get the `:path` value (request pseudo headers only).
*/
AWS_HTTP_API
int aws_http2_headers_get_request_path(const struct aws_http_headers *h2_headers, struct aws_byte_cursor *out_path);

/**
* Set `:path` (request pseudo headers only).
* The pseudo headers makes its own copy of the underlying string.
*/
AWS_HTTP_API
int aws_http2_headers_set_request_path(struct aws_http_headers *h2_headers, struct aws_byte_cursor path);

/**
* Get `:status` (response pseudo headers only).
* If no status is set, AWS_ERROR_HTTP_DATA_NOT_AVAILABLE is raised.
*/
AWS_HTTP_API
int aws_http2_headers_get_response_status(const struct aws_http_headers *h2_headers, int *out_status_code);

/**
* Set `:status` (response pseudo headers only).
*/
AWS_HTTP_API
int aws_http2_headers_set_response_status(struct aws_http_headers *h2_headers, int status_code);

/**
* Create a new HTTP/1.1 request message.
* The message is blank, all properties (method, path, etc) must be set individually.
* If HTTP/1.1 message used in HTTP/2 connection, the transformation will be automatically applied.
* A HTTP/2 message will created and sent based on the HTTP/1.1 message.
*
* The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
*/
Expand All @@ -515,14 +584,34 @@ struct aws_http_message *aws_http_message_new_request_with_headers(
struct aws_http_headers *existing_headers);

/**
* Create a new response message.
* Create a new HTTP/1.1 response message.
* The message is blank, all properties (status, headers, etc) must be set individually.
*
* The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
*/
AWS_HTTP_API
struct aws_http_message *aws_http_message_new_response(struct aws_allocator *allocator);

/**
* Create a new HTTP/2 request message.
* pseudo headers need to be set from aws_http2_headers_set_request_* to the headers of the aws_http_message.
* Will be errored out if used in HTTP/1.1 connection.
*
* The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
*/
AWS_HTTP_API
struct aws_http_message *aws_http2_message_new_request(struct aws_allocator *allocator);

/**
* Create a new HTTP/2 response message.
* pseudo headers need to be set from aws_http2_headers_set_response_status to the headers of the aws_http_message.
* Will be errored out if used in HTTP/1.1 connection.
*
* The caller has a hold on the object and must call aws_http_message_release() when they are done with it.
*/
AWS_HTTP_API
struct aws_http_message *aws_http2_message_new_response(struct aws_allocator *allocator);

/**
* Acquire a hold on the object, preventing it from being deleted until
* aws_http_message_release() is called by all those with a hold on it.
Expand All @@ -549,6 +638,12 @@ bool aws_http_message_is_request(const struct aws_http_message *message);
AWS_HTTP_API
bool aws_http_message_is_response(const struct aws_http_message *message);

/**
* Get the protocol version of the http message.
*/
AWS_HTTP_API
enum aws_http_version aws_http_message_get_protocol_version(const struct aws_http_message *message);

/**
* Get the method (request messages only).
*/
Expand Down
Loading