static int initialize_received_data()

in src/uhttp.c [106:133]


static int initialize_received_data(HTTP_CLIENT_HANDLE_DATA* http_data)
{
    int result = 0;

    // Initialize data if necessary
    if (http_data->recv_msg.resp_header == NULL)
    {
        http_data->recv_msg.resp_header = HTTPHeaders_Alloc();
        if (http_data->recv_msg.resp_header == NULL)
        {
            /* Codes_SRS_UHTTP_07_048: [ If any error is encountered on_bytes_received shall set the state to error. ] */
            LogError("Failure creating Http header.");
            result = MU_FAILURE;
        }
    }
    if (result == 0 && http_data->recv_msg.accrual_buff == NULL)
    {
        http_data->recv_msg.accrual_buff = BUFFER_new();
        if (http_data->recv_msg.accrual_buff == NULL)
        {
            /* Codes_SRS_UHTTP_07_048: [ If any error is encountered on_bytes_received shall set the state to error. ] */
            LogError("Failure creating accrual buffer.");
            result = MU_FAILURE;
        }
    }
    http_data->recv_msg.chunked_reply = false;
    return result;
}