in source/rest.c [275:303]
static int s_on_incoming_headers_fn(
struct aws_http_stream *stream,
enum aws_http_header_block header_block,
const struct aws_http_header *header_array,
size_t num_headers,
void *user_data) {
(void)stream;
int status = 0;
int rc = 0;
struct request_ctx *ctx = user_data;
if (!ctx->response_code_written) {
rc = aws_http_stream_get_incoming_response_status(stream, &status);
if (rc != AWS_OP_SUCCESS) {
return rc;
}
rc = aws_http_message_set_response_status(ctx->response->response, status);
if (rc != AWS_OP_SUCCESS) {
return rc;
}
ctx->response_code_written = true;
}
if (header_block != AWS_HTTP_HEADER_BLOCK_MAIN) {
return AWS_OP_SUCCESS;
}
return aws_http_headers_add_array(aws_http_message_get_headers(ctx->response->response), header_array, num_headers);
}