Files
egutierrez bd5751d30d chore: auto-commit (7 archivos)
- CMakeLists.txt
- app.md
- appicon.ico
- http_client.cpp
- http_client.h
- main.cpp
- vendor/

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 00:31:31 +02:00

31 lines
960 B
C++

#pragma once
// Minimal HTTP client — no threading, no SSL, just plain TCP to localhost.
// Works with both win32 and posix MinGW thread models.
#include <string>
struct HttpResponse {
int status = 0;
std::string body;
bool ok() const { return status >= 200 && status < 300; }
};
// Simple blocking HTTP GET/POST over TCP sockets.
// host: "127.0.0.1", port: 8484
class HttpClient {
public:
HttpClient(const std::string& host, int port);
HttpResponse get(const std::string& path);
HttpResponse post(const std::string& path, const std::string& body,
const std::string& content_type = "application/json");
private:
std::string host_;
int port_;
int timeout_sec_ = 30; // cold drift audit lee ~400MB de binarios; 5s era insuficiente
HttpResponse request(const std::string& method, const std::string& path,
const std::string& body, const std::string& content_type);
};