static void s_on_sign_complete()

in source/rest.c [386:420]


static void s_on_sign_complete(struct aws_signing_result *signing_result, int error_code, void *userdata) {
    struct request_ctx *ctx = userdata;

    if (error_code != AWS_OP_SUCCESS) {
        goto err_clean;
    }

    if (aws_apply_signing_result_to_http_request(ctx->request, ctx->rest_client->allocator, signing_result) !=
        AWS_OP_SUCCESS) {
        goto err_clean;
    }

    struct aws_http_make_request_options request_options = {
        .self_size = sizeof(request_options),
        .user_data = ctx,
        .request = ctx->request,
        .on_response_headers = s_on_incoming_headers_fn,
        .on_response_header_block_done = s_on_incoming_header_block_done_fn,
        .on_response_body = s_on_incoming_body_fn,
        .on_complete = s_on_stream_complete_fn,
    };

    struct aws_http_stream *stream = aws_http_connection_make_request(ctx->rest_client->connection, &request_options);

    if (stream == NULL || aws_http_stream_activate(stream) != AWS_OP_SUCCESS) {
        fprintf(stderr, "failed to create request.");
        goto err_clean;
    }

    return;
err_clean:
    ctx->error_code = AWS_OP_ERR;
    aws_http_stream_release(stream);
    aws_condition_variable_notify_all(&ctx->c_var);
}