![]() |
LINE Solver (C++)
Templated C++ port of the LINE queueing solver
|
Minimal HTTP/1.1 client, enough to talk to a line-*-rest service. More...
#include <cctype>#include <cerrno>#include <cstddef>#include <cstdlib>#include <cstring>#include <string>#include <fcntl.h>#include <netdb.h>#include <poll.h>#include <sys/socket.h>#include <sys/types.h>#include <unistd.h>#include "line/util/error.h"Go to the source code of this file.
Classes | |
| class | line::http::HttpError |
| Transport-level failure: unresolvable host, refused connection, timeout. More... | |
| struct | line::http::Response |
| An HTTP response, with the body already de-chunked. More... | |
| struct | line::http::Url |
| The pieces of an http:// URL this client needs. More... | |
Namespaces | |
| namespace | line |
| namespace | line::http |
Functions | |
| Url | line::http::parse_url (const std::string &url) |
| Splits an http:// URL. | |
| Response | line::http::get (const std::string &url, int timeoutMillis) |
| GET a URL. | |
| Response | line::http::post_json (const std::string &url, const std::string &json, int timeoutMillis) |
| POST a JSON document. | |
Minimal HTTP/1.1 client, enough to talk to a line-*-rest service.
The port needs this for api/sym, whose only backend is the line-sage-rest service: the JAR reaches it through HttpURLConnection, MATLAB through webwrite and Python through requests, and there is no equivalent in the C++ standard library. Rather than take a dependency on libcurl or Boost.Beast – the first is a link-time obligation for every binary in the tree, the second pulls in Asio and its thread requirements – this speaks the protocol directly over a POSIX socket. What it supports is exactly what the service uses: GET, POST of a JSON body, identity and chunked transfer encodings, connect and read timeouts.
NO TLS. https:// is REFUSED BY NAME rather than silently downgraded to http. That matters because the symbolic backend is normally a container on localhost, where plaintext is correct, and a caller pointing LINE_SAGE_URL at a remote https endpoint must be told that this client cannot authenticate it rather than have the request fail obscurely or, worse, travel in the clear.
Redirects are NOT followed and cookies are not kept: the REST protocol has neither, and following a redirect silently would let a 302 turn a POST into a GET and lose the request body.
Definition in file http.h.