Skip to content
Merged
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
13 changes: 7 additions & 6 deletions bin/elasticurl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,6 @@ static void s_on_signing_complete(struct aws_http_message *request, int error_co

static void s_on_client_connection_setup(struct aws_http_connection *connection, int error_code, void *user_data) {
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);
exit(1);
}
}

if (error_code) {
fprintf(stderr, "Connection failed with error %s\n", aws_error_debug_str(error_code));
Expand All @@ -467,6 +461,13 @@ static void s_on_client_connection_setup(struct aws_http_connection *connection,
return;
}

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);
exit(1);
}
}

app_ctx->connection = connection;
app_ctx->request = s_build_http_request(app_ctx);

Expand Down