Skip to content

Latest commit

 

History

History
50 lines (45 loc) · 8.75 KB

File metadata and controls

50 lines (45 loc) · 8.75 KB

BearHttpsClient Public API Reference

This document provides a comprehensive reference for all public API functions available in the BearHttpsClient library. The BearHttpsClient is a lightweight, secure HTTPS client library built on top of BearSSL, designed for making HTTP/HTTPS requests with full SSL/TLS support.

The API is organized into logical groups covering request creation, configuration, body handling, execution, and response processing. Each function is documented with detailed usage examples and parameter descriptions.

Summary of all Public API Functions

Function Name Description
Request Creation Functions
newBearHttpsRequest Creates a new HTTP request object with the specified URL
newBearHttpsRequest_with_url_ownership_config Creates a new HTTP request object with URL ownership control
BearHttpsRequest_free Frees the memory allocated for a request object
Request Configuration Functions
BearHttpsRequest_add_header Adds a header to the HTTP request
BearHttpsRequest_add_header_fmt Adds headers to the request using a formatted string
BearHttpsRequest_set_chunk_header_read_props Configures chunk reading properties for response headers
BearHttpsRequest_set_dns_providers Sets custom DNS providers for resolving hostnames
BearHttpsRequest_set_known_ips Sets a list of known IP addresses for the request's hostname
BearHttpsRequest_set_max_redirections Sets the maximum number of HTTP redirections to follow
BearHttpsRequest_set_trusted_anchors Sets custom trusted anchors (root certificates) for SSL/TLS validation
Request Body/Payload Functions
BearHttpsRequest_create_cJSONPayloadArray Creates a new cJSON array for building JSON array payloads
BearHttpsRequest_create_cJSONPayloadObject Creates a new cJSON object for building JSON payloads
BearHttpsRequest_send_any Sends binary data as the request body (default ownership)
BearHttpsRequest_send_any_with_ownership_control Sends binary data as the request body with ownership control
BearHttpsRequest_send_body_str Sends a string as the request body (default ownership)
BearHttpsRequest_send_body_str_with_ownership_control Sends a string as the request body with ownership control
BearHttpsRequest_send_cJSON Sends a cJSON object as the request body (default ownership)
BearHttpsRequest_send_cJSON_with_ownership_control Sends a cJSON object as the request body with ownership control
Request Execution Functions
BearHttpsRequest_fetch Executes the HTTP request and returns the response
Response Handling Functions
BearHttpsResponse_error Checks if an error occurred during the HTTP request
BearHttpsResponse_free Frees the memory allocated for a response object
BearHttpsResponse_get_error_code Gets a numeric error code if an error occurred
BearHttpsResponse_get_error_msg Gets a human-readable error message if an error occurred
BearHttpsResponse_get_status_code Gets the HTTP status code from the response
Response Body Functions
BearHttpsResponse_get_body_size Gets the size of the response body in bytes
BearHttpsResponse_read_body_str Reads the response body as a null-terminated string
BearHttpsResponse_read_body_json Reads and parses the response body as a JSON object
Response Header Functions
BearHttpsResponse_get_headers_size Gets the number of headers in the HTTP response
BearHttpsResponse_get_header_key_by_index Gets the key (name) of a response header by its index position
BearHttpsResponse_get_header_value_by_index Gets the value of a response header by its index position
BearHttpsResponse_get_header_value_by_key Gets the value of a response header by its key (case-sensitive)
BearHttpsResponse_get_header_value_by_sanitized_key Gets the value of a response header by its key (case-insensitive)