Skip to content

Commit 57883a8

Browse files
authored
H2 test helper (#204)
1 parent 40056af commit 57883a8

File tree

13 files changed

+828
-553
lines changed

13 files changed

+828
-553
lines changed

include/aws/http/private/h1_decoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ AWS_HTTP_API struct aws_h1_decoder *aws_h1_decoder_new(struct aws_h1_decoder_par
8181
AWS_HTTP_API void aws_h1_decoder_destroy(struct aws_h1_decoder *decoder);
8282
AWS_HTTP_API int aws_h1_decode(struct aws_h1_decoder *decoder, struct aws_byte_cursor *data);
8383

84-
AWS_HTTP_API void aws_h1_decoder_set_logging_id(struct aws_h1_decoder *decoder, void *id);
84+
AWS_HTTP_API void aws_h1_decoder_set_logging_id(struct aws_h1_decoder *decoder, const void *id);
8585
AWS_HTTP_API void aws_h1_decoder_set_body_headers_ignored(struct aws_h1_decoder *decoder, bool body_headers_ignored);
8686

8787
/* RFC-7230 section 4.2 Message Format */

include/aws/http/private/h1_encoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct aws_h1_encoder {
4343
enum aws_h1_encoder_state state;
4444
struct aws_h1_encoder_message *message;
4545
uint64_t progress_bytes;
46-
void *logging_id;
46+
const void *logging_id;
4747
};
4848

4949
AWS_EXTERN_C_BEGIN

include/aws/http/private/h2_decoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct aws_h2_decoder_params {
8989
struct aws_allocator *alloc;
9090
const struct aws_h2_decoder_vtable *vtable;
9191
void *userdata;
92-
void *logging_id;
92+
const void *logging_id;
9393
bool is_server;
9494

9595
/* If true, do not expect the connection preface and immediately accept any frame type.

include/aws/http/private/h2_frames.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,10 @@ int aws_h2_validate_stream_id(uint32_t stream_id);
159159
* 2. Encode the frame using aws_h2_encode_frame()
160160
*/
161161
AWS_HTTP_API
162-
int aws_h2_frame_encoder_init(struct aws_h2_frame_encoder *encoder, struct aws_allocator *allocator, void *logging_id);
162+
int aws_h2_frame_encoder_init(
163+
struct aws_h2_frame_encoder *encoder,
164+
struct aws_allocator *allocator,
165+
const void *logging_id);
163166

164167
AWS_HTTP_API
165168
void aws_h2_frame_encoder_clean_up(struct aws_h2_frame_encoder *encoder);

include/aws/http/private/hpack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ AWS_HTTP_API
7171
struct aws_hpack_context *aws_hpack_context_new(
7272
struct aws_allocator *allocator,
7373
enum aws_http_log_subject log_subject,
74-
void *log_id);
74+
const void *log_id);
7575

7676
AWS_HTTP_API
7777
void aws_hpack_context_destroy(struct aws_hpack_context *context);

source/h1_decoder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct aws_h1_decoder {
5050
bool body_headers_ignored;
5151
bool body_headers_forbidden;
5252
enum aws_http_header_block header_block;
53-
void *logging_id;
53+
const void *logging_id;
5454

5555
/* User callbacks and settings. */
5656
struct aws_h1_decoder_vtable vtable;
@@ -766,7 +766,7 @@ enum aws_http_header_block aws_h1_decoder_get_header_block(const struct aws_h1_d
766766
return decoder->header_block;
767767
}
768768

769-
void aws_h1_decoder_set_logging_id(struct aws_h1_decoder *decoder, void *id) {
769+
void aws_h1_decoder_set_logging_id(struct aws_h1_decoder *decoder, const void *id) {
770770
decoder->logging_id = id;
771771
}
772772

source/h2_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static const struct decoder_state *s_state_frames[] = {
125125
struct aws_h2_decoder {
126126
/* Implementation data. */
127127
struct aws_allocator *alloc;
128-
void *logging_id;
128+
const void *logging_id;
129129
struct aws_hpack_context *hpack;
130130
bool is_server;
131131
struct aws_byte_buf scratch;

source/h2_frames.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,10 @@ static void s_frame_prefix_encode(
231231
/***********************************************************************************************************************
232232
* Encoder
233233
**********************************************************************************************************************/
234-
int aws_h2_frame_encoder_init(struct aws_h2_frame_encoder *encoder, struct aws_allocator *allocator, void *logging_id) {
234+
int aws_h2_frame_encoder_init(
235+
struct aws_h2_frame_encoder *encoder,
236+
struct aws_allocator *allocator,
237+
const void *logging_id) {
235238

236239
AWS_PRECONDITION(encoder);
237240
AWS_PRECONDITION(allocator);

source/hpack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ struct aws_hpack_context {
230230

231231
enum aws_hpack_huffman_mode huffman_mode;
232232
enum aws_http_log_subject log_subject;
233-
void *log_id;
233+
const void *log_id;
234234

235235
struct aws_huffman_encoder encoder;
236236
struct aws_huffman_decoder decoder;
@@ -316,7 +316,7 @@ struct aws_hpack_context {
316316
struct aws_hpack_context *aws_hpack_context_new(
317317
struct aws_allocator *allocator,
318318
enum aws_http_log_subject log_subject,
319-
void *log_id) {
319+
const void *log_id) {
320320

321321
struct aws_hpack_context *context = aws_mem_calloc(allocator, 1, sizeof(struct aws_hpack_context));
322322
if (!context) {

0 commit comments

Comments
 (0)