Вк LongPoll возвращает 404

Я использую Curl для запросов. Получение сервера

  auto ret = this->api->call("messages.getLongPollServer", "");        //он сам вставит версию и тд

  try
  {
    ret = ret["response"];
    this->_server = ret["server"].get<std::string>();
    this->_key = ret["key"].get<std::string>();
    this->ts = ret["ts"].get<eventnum>();
  }
  catch (std::exception & e)
  {
    std::cout << "GetLongPollServer error : " << e.what() << std::endl;
  }

Сам по себе сервер сохраняется в переменную, но если вызывать его через код (см. получение данных с лонгпула), то ошибка 404

Получение данных с лонгпула

    std::string url = "https://" + this->_server;
    params_map data;
    data.insert({"act", "a_check"});
    data.insert({ "key", this->_key });
    data.insert({ "ts", std::to_string(this->ts)});
    data.insert({ "wait", "25" });
    data.insert({ "mode", "10" });
    data.insert({ "version", "2" });

    json ret = NULL;

    std::string res = request(url, Utils::data2str(data));

    while (ret == NULL)
    {
        try {
            res = request(url, Utils::data2str(data));
            json jres = json::parse(res);
            ret = jres;
        }
        catch (...) {

        }
    }

    return ret;

Функция запросов

    static char errorBuffer[CURL_ERROR_SIZE];
    curl_buffer.clear();

    CURL* curl = curl_easy_init();
    if (curl) {
        curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
        curl_easy_setopt(curl, CURLOPT_USERAGENT, "VK API Client");
        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str());
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, VK::Utils::CURL_WRITER);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &curl_buffer);
        curl_easy_setopt(curl, CURLOPT_USE_SSL, 0L);

        CURLcode result = curl_easy_perform(curl);
        curl_easy_cleanup(curl);
        if (result == CURLE_OK) {
            return curl_buffer;
        }
        else {
            return errorBuffer;
        }
    }
    curl_easy_cleanup(curl);

    return "";

Ответы (0 шт):