![]() |
Kurlyk
|
Concrete HTTP client for making requests to a specific host. More...
#include <HttpClient.hpp>
Public Member Functions | |
| HttpClient () | |
| Default constructor for HttpClient. | |
| HttpClient (const std::string &host) | |
| Constructs an HttpClient with the specified host. | |
| HttpClient (const HttpClient &)=delete | |
| HttpClient & | operator= (const HttpClient &)=delete |
| HttpClient (HttpClient &&)=delete | |
| HttpClient & | operator= (HttpClient &&)=delete |
| ~HttpClient () | |
| Destroys the client, cancels requests associated with this client, and releases owned rate limits. | |
| void | cancel_requests () |
| Cancels requests associated with this client and waits for cancellation callbacks. | |
| void | wait_requests () |
| Waits until all requests associated with this client group finish. | |
| bool | wait_requests_for (std::chrono::milliseconds timeout) |
| Waits until all requests associated with this client group finish or timeout expires. | |
| void | set_max_in_flight (std::size_t max_in_flight) |
| Sets maximum number of requests this client may submit while its group is busy. | |
| std::size_t | max_in_flight () const |
| Returns this client's configured admission cap. | |
| std::size_t | in_flight_requests () const |
| Returns number of pending, active, and retry requests currently observed for this client group. | |
| void | clear_rate_limit (RateLimitType type=RateLimitType::RL_GENERAL) |
| Clears the configured rate limit of the specified type. | |
| void | set_host (const std::string &host) |
| Sets the host URL for the HTTP client. | |
| void | set_headers (const kurlyk::Headers &headers) |
| Sets the default headers for HTTP requests. | |
| bool | assign_rate_limit_id (long limit_id, RateLimitType type=RateLimitType::RL_GENERAL) |
| Assigns an existing rate limit to future requests by ID. | |
| bool | assign_rate_limit_handle (const HttpRateLimitHandlePtr &limit, RateLimitType type=RateLimitType::RL_GENERAL) |
| Assigns an existing rate-limit handle to future requests. | |
| bool | set_rate_limit_id (long limit_id, RateLimitType type=RateLimitType::RL_GENERAL) |
| Sets the rate limit ID for the HTTP request (alias for assign_rate_limit_id). | |
| bool | set_rate_limit_handle (const HttpRateLimitHandlePtr &limit, RateLimitType type=RateLimitType::RL_GENERAL) |
| Sets an existing rate-limit handle for future requests. | |
| void | set_rate_limit (long requests_per_period, long period_ms, RateLimitType type=RateLimitType::RL_GENERAL, bool sequential=false) |
| Creates and assigns an owned rate limit for future requests. | |
| void | set_rate_limit_rpm (long requests_per_minute, RateLimitType type=RateLimitType::RL_GENERAL, bool sequential=false) |
| Sets the rate limit based on requests per minute (RPM). | |
| void | set_rate_limit_rps (long requests_per_second, RateLimitType type=RateLimitType::RL_GENERAL, bool sequential=false) |
| Sets the rate limit based on requests per second (RPS). | |
| void | set_rate_limit_key (const std::string &key) |
| Sets the partition key for both rate limits (general and specific). | |
| void | set_general_rate_limit_key (const std::string &key) |
| Sets the partition key for the general rate limit. | |
| void | set_specific_rate_limit_key (const std::string &key) |
| Sets the partition key for the specific rate limit. | |
| void | set_rate_limit_keys (const std::string &general_key, const std::string &specific_key) |
| Sets independent partition keys for general and specific rate limits. | |
| void | set_accept_encoding (bool identity=false, bool deflate=false, bool gzip=false, bool brotli=false) |
| Sets the Accept-Encoding header. | |
| void | set_accept_encoding (const std::string &value) |
| Sets a custom Accept-Encoding header value. | |
| void | set_accept_language (const std::string &value) |
| Sets the Accept-Language header value. | |
| void | set_content_type (const std::string &value) |
| Sets the Content-Type header value. | |
| void | set_origin (const std::string &value) |
| Sets the Origin header value. | |
| void | set_referer (const std::string &value) |
| Sets the Referer header value. | |
| void | set_dnt (const bool value) |
| Sets the Do Not Track (DNT) header value. | |
| void | set_follow_location (bool value) |
| Configures whether to follow redirects automatically. | |
| void | set_auto_referer (bool value) |
| Configures whether to automatically set the Referer header on redirects. | |
| void | set_proxy_tunnel (bool value) |
| Configures whether to use a tunneling proxy for HTTP requests. | |
| void | set_head_only (bool value) |
| Configures whether to send only the HTTP headers (HEAD request). | |
| void | set_streaming (bool streaming) |
| Enables or disables intermediate callbacks for response body chunks. | |
| void | set_proxy (const std::string &ip, int port, ProxyType type=ProxyType::PROXY_HTTP) |
| Sets the proxy server address. | |
| void | set_proxy (const std::string &ip, const int port, const std::string &username, const std::string &password, ProxyType type=ProxyType::PROXY_HTTP) |
| Sets the proxy server address with authentication details. | |
| void | set_proxy_auth (const std::string &username, const std::string &password) |
| Sets proxy authentication credentials. | |
| void | set_proxy_server (const std::string &server) |
| Sets the proxy server address. | |
| void | set_proxy_auth (const std::string &auth) |
| Sets the proxy authentication credentials. | |
| void | set_proxy_type (ProxyType type) |
| Sets the proxy type. | |
| void | set_retry_attempts (long retry_attempts, long retry_delay_ms) |
| Sets retry attempts and delay between retries for HTTP requests. | |
| void | add_valid_status (long status) |
| Adds a valid HTTP status code to the request. | |
| void | set_valid_statuses (const std::set< long > &statuses) |
| Replaces all valid HTTP status codes for the request. | |
| void | clear_valid_statuses () |
| Clears the set of valid HTTP status codes for the request. | |
| void | set_user_agent (const std::string &user_agent) |
| Sets the User-Agent header. | |
| void | set_cookie (const std::string &cookie) |
| Sets the cookie string for HTTP requests. | |
| void | set_cert_file (const std::string &cert_file) |
| Sets the client certificate file path. | |
| void | set_ca_file (const std::string &ca_file) |
| Sets the path to the CA certificate file. | |
| void | set_timeout (long timeout) |
| Sets the timeout duration for HTTP requests. | |
| void | set_connect_timeout (long connect_timeout) |
| Sets the connection timeout duration. | |
| void | set_verbose (bool verbose) |
| Enables or disables verbose output. | |
| void | set_debug_header (bool debug_header) |
| Enables or disables debug headers. | |
| void | set_max_redirects (long max_redirects) |
| Sets the maximum number of redirects for the client. | |
| SubmitResult | submit_request (std::unique_ptr< HttpRequest > request_ptr, HttpResponseCallback callback) |
| Attempts to submit a prepared request to the global HTTP manager. | |
| bool | request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, HttpResponseCallback callback) |
| Sends an HTTP request with the specified method, path, and parameters. | |
| bool | request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, long specific_rate_limit_id, HttpResponseCallback callback) |
| Sends an HTTP request with a temporary specific rate limit found by ID. | |
| bool | request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, const HttpRateLimitHandlePtr &specific_rate_limit, HttpResponseCallback callback) |
| Sends an HTTP request with a temporary specific rate limit. | |
| bool | get (const std::string &path, const QueryParams &query, const Headers &headers, HttpResponseCallback callback) |
| Sends a GET request. | |
| bool | post (const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, HttpResponseCallback callback) |
| Sends a POST request. | |
| bool | get (const std::string &path, const QueryParams &query, const Headers &headers, long specific_rate_limit_id, HttpResponseCallback callback) |
| Sends a GET request with a temporary specific rate limit found by ID. | |
| bool | get (const std::string &path, const QueryParams &query, const Headers &headers, const HttpRateLimitHandlePtr &specific_rate_limit, HttpResponseCallback callback) |
| Sends a GET request with a temporary specific rate limit. | |
| bool | post (const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, long specific_rate_limit_id, HttpResponseCallback callback) |
| Sends a POST request with a temporary specific rate limit found by ID. | |
| bool | post (const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, const HttpRateLimitHandlePtr &specific_rate_limit, HttpResponseCallback callback) |
| Sends a POST request with a temporary specific rate limit. | |
| std::future< HttpResponsePtr > | request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content) |
| Sends an HTTP request with a specified method, path, and parameters, and returns a future with the response. | |
| std::future< HttpResponsePtr > | request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, long specific_rate_limit_id) |
| Sends an HTTP request with a temporary specific rate limit found by ID and returns a future with the response. | |
| std::future< HttpResponsePtr > | request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, const HttpRateLimitHandlePtr &specific_rate_limit) |
| Sends an HTTP request with a temporary specific rate limit and returns a future with the response. | |
| std::future< HttpResponsePtr > | get (const std::string &path, const QueryParams &query, const Headers &headers) |
| Sends a GET request asynchronously and returns a future with the response. | |
| std::future< HttpResponsePtr > | post (const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content) |
| Sends a POST request asynchronously and returns a future with the response. | |
| std::future< HttpResponsePtr > | get (const std::string &path, const QueryParams &query, const Headers &headers, long specific_rate_limit_id) |
| Sends an asynchronous GET request with a temporary specific rate limit found by ID. | |
| std::future< HttpResponsePtr > | post (const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, long specific_rate_limit_id) |
| Sends an asynchronous POST request with a temporary specific rate limit found by ID. | |
| std::future< HttpResponsePtr > | get (const std::string &path, const QueryParams &query, const Headers &headers, const HttpRateLimitHandlePtr &specific_rate_limit) |
| Sends an asynchronous GET request with a temporary specific rate limit. | |
| std::future< HttpResponsePtr > | post (const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content, const HttpRateLimitHandlePtr &specific_rate_limit) |
| Sends an asynchronous POST request with a temporary specific rate limit. | |
Private Member Functions | |
| bool | request (std::unique_ptr< HttpRequest > request_ptr, HttpResponseCallback callback) |
| Adds the request to the request manager and notifies the worker to process it. | |
| void | set_header (const std::string &name, const std::string &value) |
| std::unique_ptr< HttpRequest > | make_request (const std::string &method, const std::string &path, const QueryParams &query, const Headers &headers, const std::string &content) const |
| std::future< HttpResponsePtr > | submit_future_request (std::unique_ptr< HttpRequest > request_ptr) |
| std::future< void > | make_wait_requests_future () |
| Creates a future that becomes ready when all requests in this client group finish. | |
| void | safe_submit_request (std::shared_ptr< std::promise< HttpResponsePtr > > promise, std::unique_ptr< HttpRequest > request_ptr, HttpResponseCallback callback) |
| Submits a request and propagates any failure to the provided promise. | |
Static Private Member Functions | |
| static void | safe_set_response (std::shared_ptr< std::promise< HttpResponsePtr > > promise, HttpResponsePtr response) |
| Safely sets the response value on the given promise. | |
| static HttpResponsePtr | make_submit_error_response (const SubmitResult &submit_result) |
| Creates a ready HTTP response describing a synchronous submission rejection. | |
| static void | ensure_initialized () |
| Ensures that the network worker and request manager are initialized. | |
Private Attributes | |
| HttpRequest | m_request |
| Request defaults shared by requests created by this client. | |
| std::string | m_host |
| The base host URL for the HTTP client. | |
| bool | m_owns_general_rate_limit = false |
| Flag indicating if the client owns the general rate limit. | |
| bool | m_owns_specific_rate_limit = false |
| Flag indicating if the client owns the specific rate limit. | |
| std::mutex | m_submit_mutex |
| Protects client-side submission settings and admission checks. | |
| std::size_t | m_max_in_flight = 0 |
| Maximum number of in-flight requests for this client group, or 0 for disabled. | |
Concrete HTTP client for making requests to a specific host.
Provides configuration helpers for rate limiting, proxy settings, retry logic, and request defaults.
Definition at line 17 of file HttpClient.hpp.
|
inline |
Default constructor for HttpClient.
Definition at line 21 of file HttpClient.hpp.
|
inline |
Constructs an HttpClient with the specified host.
| host | The base host URL for the HTTP client. |
Definition at line 28 of file HttpClient.hpp.
|
delete |
|
delete |
|
inline |
Destroys the client, cancels requests associated with this client, and releases owned rate limits.
Definition at line 42 of file HttpClient.hpp.
|
inline |
Adds a valid HTTP status code to the request.
| status | The HTTP status code to allow. |
Definition at line 510 of file HttpClient.hpp.
|
inline |
Assigns an existing rate-limit handle to future requests.
| limit | Shared rate-limit handle to assign. |
| type | Rate limit type to configure. |
Definition at line 237 of file HttpClient.hpp.
|
inline |
Assigns an existing rate limit to future requests by ID.
| limit_id | The unique identifier of the rate limit to assign. |
| type | Rate limit type to configure. |
Definition at line 224 of file HttpClient.hpp.
|
inline |
Cancels requests associated with this client and waits for cancellation callbacks.
Definition at line 52 of file HttpClient.hpp.
|
inline |
Clears the configured rate limit of the specified type.
| type | Rate limit type to clear. |
Definition at line 158 of file HttpClient.hpp.
|
inline |
Clears the set of valid HTTP status codes for the request.
Definition at line 521 of file HttpClient.hpp.
|
inlinestaticprivate |
Ensures that the network worker and request manager are initialized.
Definition at line 1079 of file HttpClient.hpp.
|
inline |
Sends a GET request asynchronously and returns a future with the response.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
Definition at line 841 of file HttpClient.hpp.
|
inline |
Sends an asynchronous GET request with a temporary specific rate limit.
| path | URL path for the request. |
| query | Query parameters. |
| headers | Additional HTTP headers. |
| specific_rate_limit | Specific rate-limit handle applied only to this request. |
Definition at line 900 of file HttpClient.hpp.
|
inline |
Sends a GET request with a temporary specific rate limit.
| path | URL path for the request. |
| query | Query parameters. |
| headers | Additional HTTP headers. |
| specific_rate_limit | Specific rate-limit handle applied only to this request. |
| callback | Callback invoked when the request completes. |
Definition at line 729 of file HttpClient.hpp.
|
inline |
Sends a GET request.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| callback | The callback function to be called when the request is completed. |
Definition at line 681 of file HttpClient.hpp.
|
inline |
Sends an asynchronous GET request with a temporary specific rate limit found by ID.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| specific_rate_limit_id | ID of a registered rate limit. |
Definition at line 869 of file HttpClient.hpp.
|
inline |
Sends a GET request with a temporary specific rate limit found by ID.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| specific_rate_limit_id | ID of a registered rate limit. |
| callback | The callback function to be called when the request is completed. |
Definition at line 713 of file HttpClient.hpp.
|
inline |
Returns number of pending, active, and retry requests currently observed for this client group.
Definition at line 152 of file HttpClient.hpp.
|
inlineprivate |
Definition at line 950 of file HttpClient.hpp.
|
inlinestaticprivate |
Creates a ready HTTP response describing a synchronous submission rejection.
| submit_result | Submission result containing the rejection error code. |
Definition at line 1039 of file HttpClient.hpp.
|
inlineprivate |
Creates a future that becomes ready when all requests in this client group finish.
Definition at line 989 of file HttpClient.hpp.
|
inline |
Returns this client's configured admission cap.
Definition at line 144 of file HttpClient.hpp.
|
delete |
|
delete |
|
inline |
Sends a POST request asynchronously and returns a future with the response.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
Definition at line 854 of file HttpClient.hpp.
|
inline |
Sends an asynchronous POST request with a temporary specific rate limit.
| path | URL path for the request. |
| query | Query parameters. |
| headers | Additional HTTP headers. |
| content | Request body content. |
| specific_rate_limit | Specific rate-limit handle applied only to this request. |
Definition at line 915 of file HttpClient.hpp.
|
inline |
Sends a POST request with a temporary specific rate limit.
| path | URL path for the request. |
| query | Query parameters. |
| headers | Additional HTTP headers. |
| content | Request body content. |
| specific_rate_limit | Specific rate-limit handle applied only to this request. |
| callback | Callback invoked when the request completes. |
Definition at line 765 of file HttpClient.hpp.
|
inline |
Sends a POST request.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
| callback | The callback function to be called when the request is completed. |
Definition at line 696 of file HttpClient.hpp.
|
inline |
Sends an asynchronous POST request with a temporary specific rate limit found by ID.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
| specific_rate_limit_id | ID of a registered rate limit. |
Definition at line 885 of file HttpClient.hpp.
|
inline |
Sends a POST request with a temporary specific rate limit found by ID.
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
| specific_rate_limit_id | ID of a registered rate limit. |
| callback | The callback function to be called when the request is completed. |
Definition at line 747 of file HttpClient.hpp.
|
inline |
Sends an HTTP request with a specified method, path, and parameters, and returns a future with the response.
| method | The HTTP method (e.g., "GET", "POST"). |
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
Definition at line 782 of file HttpClient.hpp.
|
inline |
Sends an HTTP request with a temporary specific rate limit and returns a future with the response.
| method | HTTP method, e.g. "GET" or "POST". |
| path | URL path for the request. |
| query | Query parameters. |
| headers | Additional HTTP headers. |
| content | Request body content. |
| specific_rate_limit | Specific rate-limit handle applied only to this request. |
Definition at line 824 of file HttpClient.hpp.
|
inline |
Sends an HTTP request with a temporary specific rate limit.
| method | HTTP method, e.g. "GET" or "POST". |
| path | URL path for the request. |
| query | Query parameters. |
| headers | Additional HTTP headers. |
| content | Request body content. |
| specific_rate_limit | Specific rate-limit handle applied only to this request. |
| callback | Callback invoked when the request completes. |
Definition at line 662 of file HttpClient.hpp.
|
inline |
Sends an HTTP request with the specified method, path, and parameters.
| method | The HTTP method (e.g., "GET", "POST"). |
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
| callback | The callback function to be called when the request is completed. |
Definition at line 615 of file HttpClient.hpp.
|
inline |
Sends an HTTP request with a temporary specific rate limit found by ID and returns a future with the response.
| method | The HTTP method (e.g., "GET", "POST"). |
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
| specific_rate_limit_id | ID of a registered rate limit. |
Definition at line 800 of file HttpClient.hpp.
|
inline |
Sends an HTTP request with a temporary specific rate limit found by ID.
| method | The HTTP method (e.g., "GET", "POST"). |
| path | The URL path for the request. |
| query | The query arguments. |
| headers | The HTTP headers. |
| content | The request body content. |
| specific_rate_limit_id | ID of a registered rate limit. |
| callback | The callback function to be called when the request is completed. |
Definition at line 635 of file HttpClient.hpp.
|
inlineprivate |
Adds the request to the request manager and notifies the worker to process it.
| request_ptr | The HTTP request to be sent. |
| callback | The callback function to be called when the request is completed. |
Definition at line 939 of file HttpClient.hpp.
|
inlinestaticprivate |
Safely sets the response value on the given promise.
| promise | Promise that receives the HTTP response. |
| response | Completed HTTP response to forward to the caller. |
Definition at line 1017 of file HttpClient.hpp.
|
inlineprivate |
Submits a request and propagates any failure to the provided promise.
| promise | Promise to signal upon success or failure. |
| request_ptr | Prepared HTTP request to enqueue. |
| callback | Callback executed when the request completes. |
Definition at line 1056 of file HttpClient.hpp.
|
inline |
Sets the Accept-Encoding header.
| identity | Enable identity encoding. |
| deflate | Enable deflate encoding. |
| gzip | Enable gzip encoding. |
| brotli | Enable brotli encoding. |
Definition at line 372 of file HttpClient.hpp.
|
inline |
Sets a custom Accept-Encoding header value.
| value | The custom value for the Accept-Encoding header. |
Definition at line 382 of file HttpClient.hpp.
|
inline |
Sets the Accept-Language header value.
| value | The language value to be sent with the Accept-Language header. |
Definition at line 388 of file HttpClient.hpp.
|
inline |
Configures whether to automatically set the Referer header on redirects.
| value | If true, enables automatically setting the Referer header during redirects. |
Definition at line 425 of file HttpClient.hpp.
|
inline |
Sets the path to the CA certificate file.
| ca_file | Path to the CA certificate file. |
Definition at line 545 of file HttpClient.hpp.
|
inline |
Sets the client certificate file path.
| cert_file | Path to the client certificate file. |
Definition at line 539 of file HttpClient.hpp.
|
inline |
Sets the connection timeout duration.
| connect_timeout | Connection timeout in seconds. |
Definition at line 557 of file HttpClient.hpp.
|
inline |
Sets the Content-Type header value.
| value | The MIME type for the Content-Type header. |
Definition at line 394 of file HttpClient.hpp.
|
inline |
Sets the cookie string for HTTP requests.
| cookie | Cookie data as a single string. |
Definition at line 533 of file HttpClient.hpp.
|
inline |
Enables or disables debug headers.
| debug_header | Enable (true) or disable (false) debug headers. |
Definition at line 569 of file HttpClient.hpp.
|
inline |
Sets the Do Not Track (DNT) header value.
| value | If true, sets the DNT header to "1". |
Definition at line 412 of file HttpClient.hpp.
|
inline |
Configures whether to follow redirects automatically.
| value | If true, enables following HTTP redirects. |
Definition at line 419 of file HttpClient.hpp.
|
inline |
Sets the partition key for the general rate limit.
| key | Partition key used to separate general rate-limit state. Empty string means the default shared state. |
Definition at line 346 of file HttpClient.hpp.
|
inline |
Configures whether to send only the HTTP headers (HEAD request).
| value | If true, the request will not download the response body (uses CURLOPT_NOBODY internally). Useful for measuring latency or checking resource availability without downloading content. |
Definition at line 438 of file HttpClient.hpp.
|
inlineprivate |
Definition at line 945 of file HttpClient.hpp.
|
inline |
Sets the default headers for HTTP requests.
| headers | The headers to be included with each request. |
Definition at line 188 of file HttpClient.hpp.
|
inline |
Sets the host URL for the HTTP client.
| host | The base host URL for HTTP requests. |
Definition at line 182 of file HttpClient.hpp.
|
inline |
Sets maximum number of requests this client may submit while its group is busy.
| max_in_flight | Maximum observed managed requests for this client's group. 0 disables the limit. |
Definition at line 137 of file HttpClient.hpp.
|
inline |
Sets the maximum number of redirects for the client.
| max_redirects | The maximum number of redirects allowed. |
Definition at line 575 of file HttpClient.hpp.
|
inline |
Sets the Origin header value.
| value | The origin to be sent with the Origin header. |
Definition at line 400 of file HttpClient.hpp.
|
inline |
Sets the proxy server address with authentication details.
| ip | Proxy server IP address. |
| port | Proxy server port. |
| username | Proxy username. |
| password | Proxy password. |
| type | The type of proxy, defaulting to HTTP. |
Definition at line 465 of file HttpClient.hpp.
|
inline |
Sets the proxy server address.
| ip | Proxy server IP address. |
| port | Proxy server port. |
| type | The type of proxy, defaulting to HTTP. |
Definition at line 452 of file HttpClient.hpp.
|
inline |
Sets the proxy authentication credentials.
| auth | Proxy authentication in <username:password> format. |
Definition at line 491 of file HttpClient.hpp.
|
inline |
Sets proxy authentication credentials.
| username | Proxy username. |
| password | Proxy password. |
Definition at line 477 of file HttpClient.hpp.
|
inline |
Sets the proxy server address.
| server | Proxy address in <ip:port> format. |
Definition at line 485 of file HttpClient.hpp.
|
inline |
Configures whether to use a tunneling proxy for HTTP requests.
| value | If true, enables tunneling through the proxy server. Tunneling proxies are typically used for HTTPS requests to securely forward traffic. |
Definition at line 431 of file HttpClient.hpp.
|
inline |
|
inline |
Creates and assigns an owned rate limit for future requests.
| requests_per_period | Maximum requests allowed within the period. 0 means unlimited. |
| period_ms | Period duration in milliseconds. |
| type | Rate limit type to configure. |
| sequential | When true, no other request sharing this limit may start until the current request (including all its retries) has finished. |
Definition at line 285 of file HttpClient.hpp.
|
inline |
Sets an existing rate-limit handle for future requests.
| limit | Shared rate-limit handle to assign. |
| type | Rate limit type to configure. |
Definition at line 273 of file HttpClient.hpp.
|
inline |
Sets the rate limit ID for the HTTP request (alias for assign_rate_limit_id).
| limit_id | The unique identifier of the rate limit to assign. |
| type | Specifies the rate limit type (general or specific). |
Definition at line 263 of file HttpClient.hpp.
|
inline |
Sets the partition key for both rate limits (general and specific).
| key | Partition key used to separate rate-limit state within the same limit ID. Empty string means the default shared state. |
Definition at line 338 of file HttpClient.hpp.
|
inline |
Sets independent partition keys for general and specific rate limits.
| general_key | Partition key for the general rate limit. |
| specific_key | Partition key for the specific rate limit. |
Definition at line 360 of file HttpClient.hpp.
|
inline |
Sets the rate limit based on requests per minute (RPM).
| requests_per_minute | Maximum number of requests allowed per minute. |
| type | The type of rate limit (either general or specific). |
| sequential | When true, no other request sharing this limit may start until the current request (including all its retries) has finished. |
Definition at line 314 of file HttpClient.hpp.
|
inline |
Sets the rate limit based on requests per second (RPS).
| requests_per_second | Maximum number of requests allowed per second. |
| type | The type of rate limit (either general or specific). |
| sequential | When true, no other request sharing this limit may start until the current request (including all its retries) has finished. |
Definition at line 327 of file HttpClient.hpp.
|
inline |
Sets the Referer header value.
| value | The referer URL to be sent with the Referer header. |
Definition at line 406 of file HttpClient.hpp.
|
inline |
Sets retry attempts and delay between retries for HTTP requests.
| retry_attempts | Number of retry attempts. |
| retry_delay_ms | Delay in milliseconds between retry attempts. |
Definition at line 504 of file HttpClient.hpp.
|
inline |
Sets the partition key for the specific rate limit.
| key | Partition key used to separate specific rate-limit state. Empty string means the default shared state. |
Definition at line 353 of file HttpClient.hpp.
|
inline |
Enables or disables intermediate callbacks for response body chunks.
| streaming | Enable (true) or disable (false) streaming callbacks. |
Definition at line 444 of file HttpClient.hpp.
|
inline |
Sets the timeout duration for HTTP requests.
| timeout | Timeout duration in seconds. |
Definition at line 551 of file HttpClient.hpp.
|
inline |
Sets the User-Agent header.
| user_agent | User-Agent string. |
Definition at line 527 of file HttpClient.hpp.
|
inline |
Replaces all valid HTTP status codes for the request.
| statuses | The set of HTTP status codes to allow. |
Definition at line 516 of file HttpClient.hpp.
|
inline |
Enables or disables verbose output.
| verbose | Enable (true) or disable (false) verbose output. |
Definition at line 563 of file HttpClient.hpp.
|
inlineprivate |
Definition at line 975 of file HttpClient.hpp.
|
inline |
Attempts to submit a prepared request to the global HTTP manager.
| request_ptr | Prepared HTTP request to be enqueued. |
| callback | Callback function to be called when the request is completed. |
Definition at line 585 of file HttpClient.hpp.
|
inline |
Waits until all requests associated with this client group finish.
| std::logic_error | If called from the network worker thread. |
Definition at line 91 of file HttpClient.hpp.
|
inline |
Waits until all requests associated with this client group finish or timeout expires.
| timeout | Maximum time to wait. |
Definition at line 111 of file HttpClient.hpp.
|
private |
The base host URL for the HTTP client.
Definition at line 926 of file HttpClient.hpp.
|
private |
Maximum number of in-flight requests for this client group, or 0 for disabled.
Definition at line 930 of file HttpClient.hpp.
|
private |
Flag indicating if the client owns the general rate limit.
Definition at line 927 of file HttpClient.hpp.
|
private |
Flag indicating if the client owns the specific rate limit.
Definition at line 928 of file HttpClient.hpp.
|
private |
Request defaults shared by requests created by this client.
Definition at line 925 of file HttpClient.hpp.
|
mutableprivate |
Protects client-side submission settings and admission checks.
Definition at line 929 of file HttpClient.hpp.