Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
http_client.h File Reference

A blocking HTTP client for the calls Motion Master makes out. More...

#include <chrono>
#include <expected>
#include <string>
Include dependency graph for http_client.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::net::Response
 What the server answered. More...
 
class  mm::net::HttpGlobal
 Holds libcurl's process-wide state for the lifetime of one instance. More...
 

Namespaces

namespace  mm
 
namespace  mm::net
 

Functions

std::expected< Response, std::string > mm::net::httpGet (const std::string &url, std::chrono::seconds timeout=std::chrono::seconds{ 30})
 Performs a blocking GET.
 
std::expected< Response, std::string > mm::net::httpPost (const std::string &url, const std::string &body, const std::string &contentType, std::chrono::seconds timeout=std::chrono::seconds{ 30})
 Performs a blocking POST.
 

Detailed Description

A blocking HTTP client for the calls Motion Master makes out.

Motion Master is a server, and this is the small counterpart it needs as a client: it downloads its own TLS certificate from a release, and it drives the auto-tuning child process over HTTP on loopback. Both calls block the thread they run on, which is what every caller wants — each one already runs off the event loop, on a router worker thread or on a startup path.

libcurl lives behind these two functions. It is linked privately, so no curl type appears in a header and no other target inherits the dependency.