Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
mm::net Namespace Reference

Classes

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

Functions

std::expected< Response, std::string > httpGet (const std::string &url, std::chrono::seconds timeout=std::chrono::seconds{ 30})
 Performs a blocking GET.
 
std::expected< Response, std::string > 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.
 

Function Documentation

◆ httpGet()

std::expected< Response, std::string > mm::net::httpGet ( const std::string &  url,
std::chrono::seconds  timeout = std::chrono::seconds{ 30} 
)

Performs a blocking GET.

Parameters
urlAbsolute URL. Redirects are followed, up to ten of them, which release asset URLs need: they answer 302 towards a separate download host.
timeoutWhole-call limit, including connect and transfer.
Returns
The reply, or an error string naming the URL and the transport failure.

◆ httpPost()

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.

Parameters
urlAbsolute URL. Redirects are followed as for httpGet.
bodyRequest body, sent with an explicit Content-Length.
contentTypeValue of the Content-Type header.
timeoutWhole-call limit, including connect and transfer.
Returns
The reply, or an error string naming the URL and the transport failure.