|
MetaImGUI 1.0.0
ImGui Application Template for C++20
|
Thin RAII wrapper around libcurl_easy for application-side fetches. More...
#include <HttpClient.h>
Public Member Functions | |
| HttpClient ()=default | |
| ~HttpClient ()=default | |
| HttpClient (const HttpClient &)=delete | |
| HttpClient & | operator= (const HttpClient &)=delete |
| HttpClient (HttpClient &&)=default | |
| HttpClient & | operator= (HttpClient &&)=default |
| HttpResponse | Get (const HttpRequest &request, const std::stop_token &stopToken) const |
| Issue a GET request, honouring stop_token cancellation. | |
| HttpResponse | Get (const HttpRequest &request) const |
| Convenience overload for the common no-cancel case. | |
Thin RAII wrapper around libcurl_easy for application-side fetches.
Centralises the boilerplate that UpdateChecker and ISSTracker had each re-implemented: SSL verification, stop_token-driven xferinfo abort, GitHub rate-limit header parsing, and exponential backoff on retry.
The design is deliberately stateless — every Get() is independent — so callers can hold a single HttpClient instance for the lifetime of the app and share it across threads.
Definition at line 65 of file HttpClient.h.
|
default |
|
default |
|
delete |
|
default |
| HttpResponse MetaImGUI::HttpClient::Get | ( | const HttpRequest & | request | ) | const |
Convenience overload for the common no-cancel case.
Definition at line 117 of file HttpClient.cpp.
References Get().
| HttpResponse MetaImGUI::HttpClient::Get | ( | const HttpRequest & | request, |
| const std::stop_token & | stopToken | ||
| ) | const |
Issue a GET request, honouring stop_token cancellation.
Retries on HttpStatus::NetworkError up to request.maxRetries times, with exponential backoff (200ms, 400ms, 800ms, ...). Cancellation and rate-limit responses are returned immediately without retry — those aren't transient.
Definition at line 78 of file HttpClient.cpp.
References MetaImGUI::Cancelled, MetaImGUI::HttpRequest::maxRetries, MetaImGUI::NetworkError, and MetaImGUI::HttpResponse::status.
Referenced by Get().
|
delete |
|
default |