LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::http Namespace Reference

Classes

class  HttpError
 Transport-level failure: unresolvable host, refused connection, timeout. More...
struct  Response
 An HTTP response, with the body already de-chunked. More...
struct  Url
 The pieces of an http:// URL this client needs. More...

Functions

Url parse_url (const std::string &url)
 Splits an http:// URL.
Response get (const std::string &url, int timeoutMillis)
 GET a URL.
Response post_json (const std::string &url, const std::string &json, int timeoutMillis)
 POST a JSON document.

Function Documentation

◆ get()

Response line::http::get ( const std::string & url,
int timeoutMillis )
inline

GET a URL.

Parameters
urlthe absolute http:// URL
timeoutMillisread timeout in milliseconds, 0 for none
Returns
the response

Definition at line 349 of file http.h.

References get().

Referenced by get().

◆ parse_url()

Url line::http::parse_url ( const std::string & url)
inline

Splits an http:// URL.

Supports host, host:port and [v6addr]:port forms.

Parameters
urlthe URL
Returns
its host, port and path

Definition at line 78 of file http.h.

References line::http::Url::host, line::InputError::InputError(), parse_url(), line::http::Url::path, line::http::Url::port, and line::UnsupportedError::UnsupportedError().

Referenced by parse_url().

◆ post_json()

Response line::http::post_json ( const std::string & url,
const std::string & json,
int timeoutMillis )
inline

POST a JSON document.

Parameters
urlthe absolute http:// URL
jsonthe request body
timeoutMillisread timeout in milliseconds, 0 for none
Returns
the response

Definition at line 361 of file http.h.

References post_json().

Referenced by line::sym::SageRestEngine::isUsable(), line::jmt::jmt_solve_rest(), line::ldes::ldes_solve_rest(), and post_json().