![]() |
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 the number of admitted requests whose final callback is still pending for this 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 (uint64_t *waiter_id) |
| 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 512 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 239 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 226 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 160 of file HttpClient.hpp.
|
inline |
Clears the set of valid HTTP status codes for the request.
Definition at line 523 of file HttpClient.hpp.
|
inlinestaticprivate |
Ensures that the network worker and request manager are initialized.
Definition at line 1085 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 843 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 902 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 731 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 683 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 871 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 715 of file HttpClient.hpp.
|
inline |
Returns the number of admitted requests whose final callback is still pending for this group.
Definition at line 154 of file HttpClient.hpp.
|
inlineprivate |
Definition at line 952 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 1045 of file HttpClient.hpp.
|
inlineprivate |
Creates a future that becomes ready when all requests in this client group finish.
Definition at line 991 of file HttpClient.hpp.
|
inline |
Returns this client's configured admission cap.
Definition at line 146 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 856 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 917 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 767 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 698 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 887 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 749 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 784 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 826 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 664 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 617 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 802 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 637 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 941 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 1023 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 1062 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 374 of file HttpClient.hpp.
|
inline |
Sets a custom Accept-Encoding header value.
| value | The custom value for the Accept-Encoding header. |
Definition at line 384 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 390 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 427 of file HttpClient.hpp.
|
inline |
Sets the path to the CA certificate file.
| ca_file | Path to the CA certificate file. |
Definition at line 547 of file HttpClient.hpp.
|
inline |
Sets the client certificate file path.
| cert_file | Path to the client certificate file. |
Definition at line 541 of file HttpClient.hpp.
|
inline |
Sets the connection timeout duration.
| connect_timeout | Connection timeout in seconds. |
Definition at line 559 of file HttpClient.hpp.
|
inline |
Sets the Content-Type header value.
| value | The MIME type for the Content-Type header. |
Definition at line 396 of file HttpClient.hpp.
|
inline |
Sets the cookie string for HTTP requests.
| cookie | Cookie data as a single string. |
Definition at line 535 of file HttpClient.hpp.
|
inline |
Enables or disables debug headers.
| debug_header | Enable (true) or disable (false) debug headers. |
Definition at line 571 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 414 of file HttpClient.hpp.
|
inline |
Configures whether to follow redirects automatically.
| value | If true, enables following HTTP redirects. |
Definition at line 421 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 348 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 440 of file HttpClient.hpp.
|
inlineprivate |
Definition at line 947 of file HttpClient.hpp.
|
inline |
Sets the default headers for HTTP requests.
| headers | The headers to be included with each request. |
Definition at line 190 of file HttpClient.hpp.
|
inline |
Sets the host URL for the HTTP client.
| host | The base host URL for HTTP requests. |
Definition at line 184 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 139 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 577 of file HttpClient.hpp.
|
inline |
Sets the Origin header value.
| value | The origin to be sent with the Origin header. |
Definition at line 402 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 467 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 454 of file HttpClient.hpp.
|
inline |
Sets the proxy authentication credentials.
| auth | Proxy authentication in <username:password> format. |
Definition at line 493 of file HttpClient.hpp.
|
inline |
Sets proxy authentication credentials.
| username | Proxy username. |
| password | Proxy password. |
Definition at line 479 of file HttpClient.hpp.
|
inline |
Sets the proxy server address.
| server | Proxy address in <ip:port> format. |
Definition at line 487 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 433 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 287 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 275 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 265 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 340 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 362 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 316 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 329 of file HttpClient.hpp.
|
inline |
Sets the Referer header value.
| value | The referer URL to be sent with the Referer header. |
Definition at line 408 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 506 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 355 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 446 of file HttpClient.hpp.
|
inline |
Sets the timeout duration for HTTP requests.
| timeout | Timeout duration in seconds. |
Definition at line 553 of file HttpClient.hpp.
|
inline |
Sets the User-Agent header.
| user_agent | User-Agent string. |
Definition at line 529 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 518 of file HttpClient.hpp.
|
inline |
Enables or disables verbose output.
| verbose | Enable (true) or disable (false) verbose output. |
Definition at line 565 of file HttpClient.hpp.
|
inlineprivate |
Definition at line 977 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 587 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 109 of file HttpClient.hpp.
|
private |
The base host URL for the HTTP client.
Definition at line 928 of file HttpClient.hpp.
|
private |
Maximum number of in-flight requests for this client group, or 0 for disabled.
Definition at line 932 of file HttpClient.hpp.
|
private |
Flag indicating if the client owns the general rate limit.
Definition at line 929 of file HttpClient.hpp.
|
private |
Flag indicating if the client owns the specific rate limit.
Definition at line 930 of file HttpClient.hpp.
|
private |
Request defaults shared by requests created by this client.
Definition at line 927 of file HttpClient.hpp.
|
mutableprivate |
Protects client-side submission settings and admission checks.
Definition at line 931 of file HttpClient.hpp.