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.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include "http.hpp"
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 4 || curl_global_init(CURL_GLOBAL_DEFAULT) != CURLE_OK)
|
||||
return 2;
|
||||
utils::http::timeouts limits;
|
||||
// A dash exercises the defaults compiled into the actual plugin source.
|
||||
if (std::string(argv[2]) != "-") limits.connect_timeout_ms = std::stol(argv[2]);
|
||||
if (std::string(argv[3]) != "-") limits.timeout_ms = std::stol(argv[3]);
|
||||
const auto started = std::chrono::steady_clock::now();
|
||||
const auto result = utils::http::get_data(argv[1], "{\"event\":\"heartbeat\"}",
|
||||
{{"Content-Type", "application/json"}, {"Authorization", "Bearer test-only"}}, "POST", limits);
|
||||
const auto wall_ms = std::chrono::duration<double, std::milli>(std::chrono::steady_clock::now() - started).count();
|
||||
if (!result) return 3;
|
||||
std::cout << "{\"curl_code\":" << result->code << ",\"http_status\":" << result->status
|
||||
<< ",\"dns_ms\":" << result->dns_ms << ",\"connect_ms\":" << result->connect_ms
|
||||
<< ",\"tls_ms\":" << result->tls_ms << ",\"first_byte_ms\":" << result->first_byte_ms
|
||||
<< ",\"total_ms\":" << result->total_ms << ",\"wall_ms\":" << wall_ms
|
||||
<< ",\"body_size\":" << result->buffer.size() << "}\n";
|
||||
curl_global_cleanup();
|
||||
}
|
||||
Reference in New Issue
Block a user