void curl_easy::perform()

in src/Windows/curl_easy.cpp [263:296]


void curl_easy::perform() const
{
    //  Start the protocol exchange with the server.
    if (!WinHttpSendRequest(
            request.get(),
            request_header_text.c_str(),
            (DWORD)request_header_text.size(),
            (PVOID)request_body_data.c_str(),
            (DWORD)request_body_data.size(),
            (DWORD)request_body_data.size(),
            0))
    {
        throw_on_error(
            GetLastError(), "curl_easy::perform/WinHttpSendRequest");
    }

    //  Wait for the response from the server.
    if (!WinHttpReceiveResponse(request.get(), nullptr))
    {
        DWORD lastError = GetLastError();
        throw_on_error(
            lastError, "curl_easy::perform/WinHttpReceiveRequest");
    }

    DWORD response_code = get_response_code();
    if (response_code >= HTTP_STATUS_BAD_REQUEST && response_code <= HTTP_STATUS_SERVER_ERROR)
    {
        log(SGX_QL_LOG_INFO,
            "HTTP Error (%d) on curl->perform() request",
            response_code);
        throw_on_error(WINHTTP_ERROR_BASE, "curl_easy::perform");
    }
    return;
}