43#include <StormByte/crypto/tls/session.hxx>
44#include <StormByte/expected.hxx>
46#include <StormByte/safe/atomic.hxx>
47#include <StormByte/safe/binary.hxx>
48#include <StormByte/safe/pointers.hxx>
49#include <StormByte/safe/string.hxx>
50#include <StormByte/safe/vector.hxx>
85 class TLSConfiguration;
134 Header(std::string_view
name = {}, std::string_view value = {});
443 bool refresh_validation_time = true) noexcept;
454 Safe::String& detail,
bool refresh_validation_time = true);
STORMBYTE_DECLARE_MAYBE_SAFE(StormByte::Buffer::Bridge)
Synchronous single-request-per-connection client.
Definition client.hxx:399
Client(Client &&other) noexcept
Transfer resolver and immutable TLS policy; moved-from clients can be reassigned but Execute returns ...
bool ConfigureTLS(const Crypto::TLS::ClientConfiguration &configuration, bool refresh_validation_time=true) noexcept
Deep-copy custom trust, identity, revocation and mTLS inputs.
Expected< Response, Error > Execute(const Request &request, const Options &options, Safe::String &detail)
Execute with an owned TLS failure explanation.
Expected< Response, Error > Execute(const Request &request, const Options &options={})
Execute one bounded request, closing its connection on all exits.
Client()
Allocate a managed resolver inside Network.
Client(const Client &other)=delete
Copying a resolver owner is disabled.
~Client() noexcept
Join retained DNS work and release provider-owned policy.
Borrowed streaming consumer of the final response body.
Definition client.hxx:287
virtual bool Begin(unsigned short status, const Safe::Vector< Header > &headers)=0
Accept or decline the final response before its body.
virtual bool Write(std::span< const std::byte > bytes)=0
Consume the next nonempty body chunk.
Receiver() noexcept=default
Construct a stateless receiver base.
Network-owned endpoint implementation state.
Bounded HTTP client API; no HTTP server or HTTP/3.
Protocol
Protocol selection.
Definition client.hxx:117
@ Automatic
HTTP/1 cleartext, h2/http1.1 HTTPS ALPN.
Definition client.hxx:118
@ HTTP1
HTTP/1.1 only.
Definition client.hxx:119
Error
Typed terminal failures; no failed request is replayed.
Definition client.hxx:95
@ TLS
TLS configuration, authentication or engine failure.
Definition client.hxx:104
@ LimitExceeded
An explicit request/response bound was exceeded.
Definition client.hxx:99
@ Allocation
Provider-side allocation or callback construction failed.
Definition client.hxx:108
@ Truncated
Incomplete message or bare TCP EOF on authenticated TLS.
Definition client.hxx:106
@ InvalidOptions
Invalid limits, deadline, protocol or moved-from client.
Definition client.hxx:98
@ InvalidURL
Invalid or unsupported absolute URL.
Definition client.hxx:96
@ ResolverBusy
Previous managed DNS work is still running.
Definition client.hxx:102
@ TimedOut
Total request deadline expired.
Definition client.hxx:100
@ Cancelled
Borrowed cancellation flag was set.
Definition client.hxx:101
@ Rejected
The streaming Receiver declined the response or failed.
Definition client.hxx:109
@ InvalidRequest
Invalid method, field or unsupported request feature.
Definition client.hxx:97
@ HTTP2
HTTP/2 engine, frame, reset or GOAWAY failure.
Definition client.hxx:107
Network module of the StormByte suite.
Root namespace of the StormByte suite.
std::conditional_t< Type::Reference< T >, std::expected< std::reference_wrapper< std::remove_reference_t< T > >, Safe::Shared< E > >, std::expected< T, Safe::Shared< E > > > Expected
Scalar request limits.
Definition client.hxx:340
Receiver * receiver
Borrowed until Execute returns; streams the final body.
Definition client.hxx:382
ByteSize wire_bytes
Maximum incoming wire plaintext.
Definition client.hxx:384
ByteSize header_bytes
Aggregate decoded headers, status and trailer bytes.
Definition client.hxx:380
Protocol protocol
Protocol policy.
Definition client.hxx:377
Size header_fields
Aggregate field count.
Definition client.hxx:381
std::chrono::milliseconds timeout
One total DNS-to-body deadline.
Definition client.hxx:378
ByteSize http2_bytes
Maximum live native HTTP/2 session allocation.
Definition client.hxx:385
Size informational_responses
Maximum interim responses.
Definition client.hxx:387
ByteSize body_bytes
Maximum buffered or streamed body in either direction.
Definition client.hxx:383
const Safe::Atomic< bool > * cancellation
Borrowed until Execute returns.
Definition client.hxx:379
Options() noexcept=default
Construct default scalar limits without allocation.
ByteSize url_bytes
Maximum URL bytes.
Definition client.hxx:386
Fully buffered request.
Definition client.hxx:192
Safe::String method
Case-sensitive method token; defaults to GET.
Definition client.hxx:226
Request(const Request &other)
Independently copy the request.
Safe::Binary body
Byte-exact request body, including NUL bytes.
Definition client.hxx:228
~Request() noexcept
Release all provider-owned fields.
Request(std::string_view url={})
Construct a GET request for a borrowed absolute URL.
Safe::Vector< Header > headers
Ordered duplicate-preserving user headers.
Definition client.hxx:227
Safe::String url
Absolute ASCII URL; fragments are rejected.
Definition client.hxx:225
Request(Request &&other) noexcept
Transfer request ownership.
Fully buffered final response; informational responses are consumed, 3xx is returned unchanged,...
Definition client.hxx:237
Safe::Vector< Header > trailers
Validated trailing fields.
Definition client.hxx:271
Safe::Binary body
Byte-exact entity body after transfer framing removal.
Definition client.hxx:272
Response(Response &&other) noexcept
Transfer response ownership.
~Response() noexcept
Release provider-owned fields.
Response(const Response &other)
Independently copy the response.
unsigned short status
Final three-digit status.
Definition client.hxx:268
Safe::Vector< Header > headers
Final fields, preserving duplicates.
Definition client.hxx:270
Response()
Construct an empty response.
Protocol protocol
Actual HTTP wire protocol.
Definition client.hxx:269
#define STORMBYTE_NETWORK_PUBLIC
Definition visibility.h:51