Skip to content

2.0#19

Merged
playmiel merged 10 commits intomainfrom
dev
Feb 24, 2026
Merged

2.0#19
playmiel merged 10 commits intomainfrom
dev

Conversation

@playmiel
Copy link
Owner

This pull request updates the API and documentation for the Async HTTP client library, introducing breaking changes for version 2. The main focus is on modernizing memory management, updating callback signatures to use smart pointers, and clarifying ownership semantics. The README and all example sketches are updated to reflect these changes, ensuring consistency and providing migration guidance.

API and Ownership Changes:

  • The SuccessCallback signature now takes a std::shared_ptr<AsyncHttpResponse> instead of a raw pointer, and all usages in examples and documentation are updated accordingly. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
  • Advanced requests now require a std::unique_ptr<AsyncHttpRequest> to transfer ownership to the client; all example usages and API documentation are updated to match. [1] [2] [3] [4] [5]
  • The README clarifies that response objects are managed via shared_ptr, and request objects via unique_ptr, with explicit notes about object lifetimes and the need to copy data if it must be retained after callbacks. [1] [2]

API Modernization and Migration:

  • The migration section in the README lists all breaking changes from v1 to v2, including new callback signatures, changed return types (e.g., getBody() now returns by value), and the removal of legacy APIs.
  • All relevant method signatures in the documentation are updated to reflect new return types and parameter ownership (get, post, put now return uint32_t and accept updated callback types). [1] [2]

Documentation and Example Consistency:

  • All examples are updated to use modern C++ smart pointers for requests and responses, ensuring users follow best practices and avoid memory errors. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
  • The README is revised throughout to match the new API, including callback signatures, memory management, and usage patterns. [1] [2] [3] [4]

Other improvements:

  • Minor improvements to documentation clarity, such as notes about keep-alive pooling and chunk data validity. [1] [2]
  • PlatformIO test configuration updated to use the correct dependency and include local library sources.

These changes modernize the library's API, improve safety and clarity, and provide clear migration guidance for users upgrading from v1 to v2.

Copilot AI review requested due to automatic review settings February 20, 2026 16:39
@playmiel playmiel self-assigned this Feb 20, 2026
@playmiel playmiel added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 20, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11acfe3cd0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the v2.0.0 breaking API update for the async HTTP client, shifting request/response ownership to smart pointers and refactoring internal subsystems (cookies, redirects, keep-alive pooling) into dedicated components, with docs/tests/examples updated accordingly.

Changes:

  • Update public API ownership: SuccessCallback uses std::shared_ptr<AsyncHttpResponse>, and advanced request() takes std::unique_ptr<AsyncHttpRequest>.
  • Refactor internal logic into CookieJar, RedirectHandler, and ConnectionPool, and modernize request/response header handling (lowercased names, getters return by value).
  • Update tests, examples, PlatformIO config, and README (including migration guidance) for v2 consistency.

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
test/test_redirects/test_main.cpp Updates redirect tests for RedirectHandler + smart-pointer request/response types.
test/test_keep_alive/test_main.cpp Updates keep-alive pooling tests to use ConnectionPool and new callback signature.
test/test_cookies/test_main.cpp Updates cookie tests to target CookieJar internals.
test/test_chunk_parse/test_main.cpp Updates chunk parsing tests for new context fields and response callback signature.
test/compile_test_internal/compile_test.cpp Avoids defining setup/loop during unit test builds.
src/third_party/miniz/miniz_tinfl.h Formatting/consistency updates in bundled third-party header.
src/third_party/miniz/miniz_export.h Removes trailing whitespace/newline artifact.
src/third_party/miniz/miniz_common.h Formatting/consistency updates in bundled third-party header.
src/third_party/miniz/miniz.h Removes trailing whitespace/newline artifact.
src/TlsTransport.cpp Removes embedded TCP transport implementation (moved to dedicated file).
src/TcpTransport.cpp New TCP transport implementation file providing createTcpTransport().
src/RedirectHandler.h New redirect handling component API.
src/RedirectHandler.cpp New redirect handling implementation and context reset logic.
src/HttpResponse.h Updates response API to return String by value for safer lifetimes.
src/HttpResponse.cpp Normalizes stored header/trailer names; updates getters to return by value.
src/HttpRequest.h Updates request API to return String by value; adds header-building helper APIs.
src/HttpRequest.cpp Normalizes stored header names; introduces reserved-size header builder for efficiency.
src/HttpHelpers.h New shared helper declarations (dates, case-insensitive compare, domain normalization).
src/HttpHelpers.cpp New shared helper implementations (HTTP date parsing, time, domain normalization).
src/HttpCommon.h Bumps version to 2.0.0; normalizes HttpHeader names to lowercase in constructor.
src/CookieJar.h New cookie-jar component API and storage model.
src/CookieJar.cpp New cookie parsing/storage/eviction implementation (extracted from client).
src/ConnectionPool.h New keep-alive connection pooling component API.
src/ConnectionPool.cpp New keep-alive connection pooling implementation.
src/AsyncHttpClient.h Public API breaking changes + internal state refactor + new component ownership.
src/AsyncHttpClient.cpp Implements v2 ownership model and delegates cookies/redirects/pooling to components.
platformio.ini Adjusts build source filter for embedded test compilation setup.
library.properties Bumps published library version to 2.0.0.
library.json Bumps published library version to 2.0.0.
examples/platformio/StreamingUpload/src/main.cpp Updates example for unique_ptr request + shared_ptr response callback.
examples/platformio/SimpleHttpsGet/src/main.cpp Updates example success callback signature.
examples/platformio/SimpleHttpsGet/platformio.ini Updates PlatformIO deps to use AsyncTCP + local library dir.
examples/platformio/SimpleGet/src/main.cpp Updates example success callback signature.
examples/platformio/SimpleGet/platformio.ini Updates PlatformIO deps to use AsyncTCP + local library dir.
examples/platformio/PostWithData/src/main.cpp Updates example success callback signature.
examples/platformio/PostWithData/platformio.ini Updates PlatformIO deps to use AsyncTCP + local library dir.
examples/platformio/MultipleRequests/src/main.cpp Updates callbacks to shared_ptr response signature.
examples/platformio/MultipleRequests/platformio.ini Updates PlatformIO deps to use AsyncTCP + local library dir.
examples/platformio/CustomHeaders/src/main.cpp Updates advanced request example to unique_ptr + new callback signature.
examples/platformio/CustomHeaders/platformio.ini Updates PlatformIO deps to use AsyncTCP + local library dir.
examples/platformio/CompileTest/src/main.cpp Updates compile-test callbacks to new signature.
examples/platformio/CompileTest/platformio.ini Updates PlatformIO deps to use AsyncTCP + local library dir.
examples/arduino/StreamingUpload/StreamingUpload.ino Updates advanced request usage to unique_ptr and new callback signature.
examples/arduino/SimpleGet/SimpleGet.ino Updates example success callback signature.
examples/arduino/PostWithData/PostWithData.ino Updates example success callback signature.
examples/arduino/NoStoreToSD/NoStoreToSD.ino Updates advanced request usage to unique_ptr and new callback signature.
examples/arduino/MultipleRequests/MultipleRequests.ino Updates callbacks to shared_ptr response signature.
examples/arduino/CustomHeaders/CustomHeaders.ino Updates example success callback signature.
README.md Updates docs for v2 API + ownership semantics + migration section + refreshed examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@playmiel playmiel merged commit 50fa208 into main Feb 24, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants