Files
tws-zombies-scripts/t6/plugins/tws-t6-gsc-utils/src/utils/http.hpp
T
josh 1121b44857 Organize scripts and add TWS plugins with HTTP timeouts
Vendor pinned T5 and T6 plugin sources under the new plugins layout. Add native HTTP deadlines, status and timing diagnostics, telemetry integration, and build/test tooling.
2026-10-09 11:02:20 -04:00

35 lines
744 B
C++

#pragma once
#include <string>
#include <optional>
#include <unordered_map>
#include <curl/curl.h>
namespace utils::http
{
struct result
{
CURLcode code = CURLE_FAILED_INIT;
std::string buffer;
long status = 0;
// Cumulative milliseconds from the start of curl_easy_perform.
double dns_ms = 0;
double connect_ms = 0;
double tls_ms = 0;
double first_byte_ms = 0;
double total_ms = 0;
};
struct timeouts
{
long connect_timeout_ms = 5000;
long timeout_ms = 15000;
};
using headers = std::unordered_map<std::string, std::string>;
std::optional<result> get_data(const std::string& url, const std::string& fields = {},
const headers& headers = {}, const std::string& method = {}, const timeouts& limits = {});
}