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.
35 lines
744 B
C++
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 = {});
|
|
}
|