From 425e5da1f00d7d2557713641e41461273251fa83 Mon Sep 17 00:00:00 2001 From: Michael Graeb Date: Tue, 13 Feb 2024 09:45:40 -0800 Subject: [PATCH] Fix a bunch of places we forget to aws_raise_error() (#462) --- .github/workflows/ci.yml | 2 +- include/aws/http/request_response.h | 12 ++++++++---- source/h1_decoder.c | 2 +- source/h1_encoder.c | 5 +---- source/proxy_connection.c | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53c3ee62e..b24b6cd73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: - 'main' env: - BUILDER_VERSION: v0.9.46 + BUILDER_VERSION: v0.9.55 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-c-http diff --git a/include/aws/http/request_response.h b/include/aws/http/request_response.h index 2f58d5cd9..73c190050 100644 --- a/include/aws/http/request_response.h +++ b/include/aws/http/request_response.h @@ -139,7 +139,8 @@ typedef void(aws_http_message_transform_fn)( * This is always invoked on the HTTP connection's event-loop thread. * * Return AWS_OP_SUCCESS to continue processing the stream. - * Return AWS_OP_ERR to indicate failure and cancel the stream. + * Return aws_raise_error(E) to indicate failure and cancel the stream. + * The error you raise will be reflected in the error_code passed to the on_complete callback. */ typedef int(aws_http_on_incoming_headers_fn)( struct aws_http_stream *stream, @@ -153,7 +154,8 @@ typedef int(aws_http_on_incoming_headers_fn)( * This is always invoked on the HTTP connection's event-loop thread. * * Return AWS_OP_SUCCESS to continue processing the stream. - * Return AWS_OP_ERR to indicate failure and cancel the stream. + * Return aws_raise_error(E) to indicate failure and cancel the stream. + * The error you raise will be reflected in the error_code passed to the on_complete callback. */ typedef int(aws_http_on_incoming_header_block_done_fn)( struct aws_http_stream *stream, @@ -171,7 +173,8 @@ typedef int(aws_http_on_incoming_header_block_done_fn)( * aws_http_stream_update_window(). * * Return AWS_OP_SUCCESS to continue processing the stream. - * Return AWS_OP_ERR to indicate failure and cancel the stream. + * Return aws_raise_error(E) to indicate failure and cancel the stream. + * The error you raise will be reflected in the error_code passed to the on_complete callback. */ typedef int( aws_http_on_incoming_body_fn)(struct aws_http_stream *stream, const struct aws_byte_cursor *data, void *user_data); @@ -181,7 +184,8 @@ typedef int( * This is always invoked on the HTTP connection's event-loop thread. * * Return AWS_OP_SUCCESS to continue processing the stream. - * Return AWS_OP_ERR to indicate failure and cancel the stream. + * Return aws_raise_error(E) to indicate failure and cancel the stream. + * The error you raise will be reflected in the error_code passed to the on_complete callback. */ typedef int(aws_http_on_incoming_request_done_fn)(struct aws_http_stream *stream, void *user_data); diff --git a/source/h1_decoder.c b/source/h1_decoder.c index 68e5aa224..c615d09a6 100644 --- a/source/h1_decoder.c +++ b/source/h1_decoder.c @@ -301,7 +301,7 @@ static int s_linestate_chunk_size(struct aws_h1_decoder *decoder, struct aws_byt decoder->logging_id, AWS_BYTE_CURSOR_PRI(input)); - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_HTTP_PROTOCOL_ERROR); } int err = aws_byte_cursor_utf8_parse_u64_hex(size, &decoder->chunk_size); diff --git a/source/h1_encoder.c b/source/h1_encoder.c index 6b9aba14b..277dce946 100644 --- a/source/h1_encoder.c +++ b/source/h1_encoder.c @@ -403,10 +403,7 @@ int aws_h1_encoder_message_init_from_response( goto error; } - err = aws_byte_buf_init(&message->outgoing_head_buf, allocator, head_total_len); - if (err) { - return AWS_OP_ERR; - } + aws_byte_buf_init(&message->outgoing_head_buf, allocator, head_total_len); bool wrote_all = true; diff --git a/source/proxy_connection.c b/source/proxy_connection.c index e402a1f70..3706c2fd5 100644 --- a/source/proxy_connection.c +++ b/source/proxy_connection.c @@ -1227,7 +1227,7 @@ static int s_setup_proxy_tls_env_variable( AWS_LS_HTTP_CONNECTION, "Failed making default TLS context because of BYO_CRYPTO, set up the tls_options for proxy_env_settings to " "make it work."); - return AWS_OP_ERR; + return aws_raise_error(AWS_ERROR_UNIMPLEMENTED); #else struct aws_tls_ctx *tls_ctx = NULL; struct aws_tls_ctx_options tls_ctx_options;