18#include <asio/awaitable.hpp>
19#include <asio/any_io_executor.hpp>
29namespace neograph::async {
31struct NEOGRAPH_API HttpResponse {
39 std::string retry_after;
57 std::vector<std::pair<std::string, std::string>> headers;
62 std::string_view get_header(std::string_view name)
const noexcept;
137 asio::any_io_executor ex,
138 std::string_view host,
139 std::string_view port,
140 std::string_view path,
141 std::string_view body,
142 std::vector<std::pair<std::string, std::string>> headers = {},
144 RequestOptions opts = {});
152 asio::any_io_executor ex,
153 std::string_view host,
154 std::string_view port,
155 std::string_view path,
156 std::vector<std::pair<std::string, std::string>> headers = {},
158 RequestOptions opts = {});
187 asio::any_io_executor ex,
188 std::string_view host,
189 std::string_view port,
190 std::string_view path,
191 std::string_view body,
192 std::vector<std::pair<std::string, std::string>> headers,
194 std::function<
void(std::string_view chunk)> on_chunk,
201 std::vector<std::pair<std::string, std::string>>
headers;
204 std::string_view
get_header(std::string_view name)
const noexcept;
217 asio::any_io_executor ex,
218 std::string_view method,
219 std::string_view host,
220 std::string_view port,
221 std::string_view target,
222 std::string_view body,
223 std::vector<std::pair<std::string, std::string>> headers,
226 std::function<
void(std::string_view chunk)> on_chunk,
NEOGRAPH_API export/import macro for shared-library builds.
NEOGRAPH_API asio::awaitable< HttpStreamResponse > async_post_stream(asio::any_io_executor ex, std::string_view host, std::string_view port, std::string_view path, std::string_view body, std::vector< std::pair< std::string, std::string > > headers, bool tls, std::function< void(std::string_view chunk)> on_chunk, RequestOptions opts={})
Async HTTP(S) POST with chunked, bounded Content-Length, or close-delimited response bodies.
NEOGRAPH_API asio::awaitable< HttpResponse > async_post(asio::any_io_executor ex, std::string_view host, std::string_view port, std::string_view path, std::string_view body, std::vector< std::pair< std::string, std::string > > headers={}, bool tls=false, RequestOptions opts={})
Async HTTP(S) POST.
NEOGRAPH_API asio::awaitable< HttpResponse > async_get(asio::any_io_executor ex, std::string_view host, std::string_view port, std::string_view path, std::vector< std::pair< std::string, std::string > > headers={}, bool tls=false, RequestOptions opts={})
Async HTTP(S) GET.
NEOGRAPH_API asio::awaitable< HttpStreamResponse > async_request_stream(asio::any_io_executor ex, std::string_view method, std::string_view host, std::string_view port, std::string_view target, std::string_view body, std::vector< std::pair< std::string, std::string > > headers, bool tls, std::function< void(const HttpResponseHead &)> on_head, std::function< void(std::string_view chunk)> on_chunk, RequestOptions opts={})
Async HTTP(S) request of any method (POST, GET, DELETE, ...) with a streamed response.
Status and headers of a streamed response, reported before its body.
std::vector< std::pair< std::string, std::string > > headers
Every response header, in wire order.
std::string_view get_header(std::string_view name) const noexcept
Case-insensitive header lookup; empty when the header is absent.
Metadata returned by async_post_stream after the body has been fully delivered via the callback.
std::chrono::milliseconds timeout
Per-hop deadline covering connect + handshake + write + read of one HTTP exchange.
bool allow_replay
For ConnPool, permit one replay after a stale keep-alive connection fails.
std::size_t max_response_chunk_bytes
Maximum bytes accepted in one HTTP transfer chunk (or one Curl body callback).
std::chrono::milliseconds connect_timeout
Deadline for establishing the connection only: name resolution, the TCP connect and,...
std::size_t max_response_header_bytes
Maximum bytes accepted for a response status/header block, trailer block, or individual chunk-size li...
std::size_t max_response_body_bytes
Maximum decoded response body bytes accepted per hop.
int max_redirects
Max 3xx hops to follow automatically.