Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions bin/elasticurl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ static void s_usage(int exit_code) {
fprintf(stderr, " -t, --trace FILE: dumps logs to FILE instead of stderr.\n");
fprintf(stderr, " -v, --verbose: ERROR|INFO|DEBUG|TRACE: log level to configure. Default is none.\n");
fprintf(stderr, " --version: print the version of elasticurl.\n");
fprintf(stderr, " --http2: HTTP/2 connection required");
fprintf(stderr, " --http1_1: HTTP/1.1 connection required");
fprintf(stderr, " --http2: HTTP/2 connection required\n");
fprintf(stderr, " --http1_1: HTTP/1.1 connection required\n");
fprintf(stderr, " -h, --help\n");
fprintf(stderr, " Display this message and quit.\n");
exit(exit_code);
Expand Down Expand Up @@ -463,7 +463,7 @@ static void s_on_client_connection_setup(struct aws_http_connection *connection,
struct elasticurl_ctx *app_ctx = user_data;
if (app_ctx->required_http_version) {
if (aws_http_connection_get_version(connection) != app_ctx->required_http_version) {
fprintf(stderr, "Error. The requested http version, %s, is not supported by the peer.", app_ctx->alpn);
fprintf(stderr, "Error. The requested HTTP version, %s, is not supported by the peer.", app_ctx->alpn);
exit(1);
}
}
Expand Down Expand Up @@ -690,7 +690,7 @@ int main(int argc, char **argv) {
}
} else {
if (app_ctx.required_http_version == AWS_HTTP_VERSION_2) {
fprintf(stderr, "Error, we don't support h2c, please use TLS for HTTP2 connection");
fprintf(stderr, "Error, we don't support h2c, please use TLS for HTTP/2 connection");
exit(1);
}
port = 80;
Expand Down
1 change: 0 additions & 1 deletion source/h2_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1804,7 +1804,6 @@ static bool s_connection_is_open(const struct aws_http_connection *connection_ba
/* Send a GOAWAY with the lowest possible last-stream-id */
static void s_send_goaway(struct aws_h2_connection *connection, enum aws_h2_error_code h2_error_code) {
AWS_PRECONDITION(aws_channel_thread_is_callers_thread(connection->base.channel_slot->channel));
AWS_PRECONDITION(!connection->thread_data.is_writing_stopped);

uint32_t last_stream_id = aws_min_u32(
connection->thread_data.latest_peer_initiated_stream_id, connection->thread_data.goaway_sent_last_stream_id);
Expand Down
3 changes: 2 additions & 1 deletion source/h2_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ int aws_h2_stream_encode_data_frame(

/* Failed to write DATA, treat it as a Stream Error */
AWS_H2_STREAM_LOGF(ERROR, stream, "Error encoding stream DATA, %s", aws_error_name(aws_last_error()));
return aws_last_error();
s_send_rst_and_close_stream(stream, aws_h2err_from_last_error());
return AWS_OP_SUCCESS;
}

if (body_complete) {
Expand Down
21 changes: 10 additions & 11 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,22 +331,22 @@ add_test_case(h2_client_stream_create)
add_test_case(h2_client_unactivated_stream_cleans_up)
add_test_case(h2_client_connection_preface_sent)
add_test_case(h2_client_ping_ack)
add_test_case(h2_client_ping_ack_higher_priority)
add_test_case(h2_client_setting_ack)
add_test_case(h2_client_request_cookie_headers)
add_test_case(h2_client_stream_complete)
add_test_case(h2_client_close)
#TODO add_test_case(h2_client_close_with_incomplete_stream)
add_test_case(h2_client_stream_with_h1_request_message)
add_test_case(h2_client_stream_err_malformed_header)
#TODO add_test_case(h2_client_stream_err_state_forbids_frame)
add_test_case(h2_client_stream_err_state_forbids_frame)
add_test_case(h2_client_conn_err_stream_frames_received_for_idle_stream)
add_test_case(h2_client_stream_ignores_some_frames_received_soon_after_closing)
#TODO add_test_case(h2_client_conn_err_stream_frames_received_long_after_closing)
#TODO add_test_case(h2_client_conn_err_stream_frames_received_after_rst_stream_received)
#TODO add_test_case(h2_client_stream_receive_info_headers)
#TODO add_test_case(h2_client_stream_err_receive_info_headers_after_main)
#TODO add_test_case(h2_client_stream_receive_trailing_headers)
#TODO add_test_case(h2_client_stream_err_receive_trailing_before_main)
add_test_case(h2_client_conn_err_stream_frames_received_after_rst_stream_received)
Copy link
Contributor Author

@TingDaoK TingDaoK May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, should this be a stream error instead of connection error? "An endpoint that receives any frame other than PRIORITY after receiving a RST_STREAM MUST treat that as a stream error (Section 5.4.2) of type STREAM_CLOSED" stream_closed_state
Updated here, upcoming PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, you're right!
Guess this should be something like
h2_client_stream_err_frames_received_after_rst_stream_received

add_test_case(h2_client_stream_receive_info_headers)
add_test_case(h2_client_stream_err_receive_info_headers_after_main)
add_test_case(h2_client_stream_receive_trailing_headers)
add_test_case(h2_client_stream_err_receive_trailing_before_main)
add_test_case(h2_client_stream_receive_data)
add_test_case(h2_client_stream_err_receive_data_before_headers)
add_test_case(h2_client_stream_send_data)
Expand All @@ -362,11 +362,10 @@ add_test_case(h2_client_stream_send_window_update)
add_test_case(h2_client_conn_err_window_update_exceed_max)
add_test_case(h2_client_conn_err_window_update_size_zero)
add_test_case(h2_client_conn_err_initial_window_size_cause_window_exceed_max)
#TODO add_test_case(h2_client_stream_receive_end_stream_before_done_sending)
#TODO add_test_case(h2_client_stream_receive_end_stream_and_rst_before_done_sending)
#TODO add_test_case(h2_client_stream_err_input_stream_failure)
add_test_case(h2_client_stream_receive_end_stream_before_done_sending)
add_test_case(h2_client_stream_receive_end_stream_and_rst_before_done_sending)
add_test_case(h2_client_stream_err_input_stream_failure)
add_test_case(h2_client_stream_err_receive_rst_stream)
add_test_case(h2_client_stream_receive_rst_stream_after_complete_response_ok)
add_test_case(h2_client_push_promise_automatically_rejected)
add_test_case(h2_client_conn_receive_goaway)
add_test_case(h2_client_conn_err_invalid_last_stream_id_goaway)
Expand Down
Loading