refactor(ffi): Add Reason-Phrase API

This adds an internal ability to copy the HTTP/1 reason-phrase and place
it in the `http::Extensions` of a response, if it doesn't match the
canonical reason. This could be exposed in the Rust API later, but for
now it is only used by the C API.
This commit is contained in:
Sean McArthur
2021-01-07 17:22:12 -08:00
parent 4c32daeea0
commit c9c46ed60b
5 changed files with 88 additions and 4 deletions

View File

@@ -349,6 +349,26 @@ void hyper_response_free(hyper_response *resp);
*/
uint16_t hyper_response_status(const hyper_response *resp);
/*
Get a pointer to the reason-phrase of this response.
This buffer is not null-terminated.
This buffer is owned by the response, and should not be used after
the response has been freed.
Use `hyper_response_reason_phrase_len()` to get the length of this
buffer.
*/
const uint8_t *hyper_response_reason_phrase(const hyper_response *resp);
/*
Get the length of the reason-phrase of this response.
Use `hyper_response_reason_phrase()` to get the buffer pointer.
*/
size_t hyper_response_reason_phrase_len(const hyper_response *resp);
/*
Get the HTTP version used by this response.