Conversation
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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:
SuccessCallbackusesstd::shared_ptr<AsyncHttpResponse>, and advancedrequest()takesstd::unique_ptr<AsyncHttpRequest>. - Refactor internal logic into
CookieJar,RedirectHandler, andConnectionPool, 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.
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:
SuccessCallbacksignature now takes astd::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]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]shared_ptr, and request objects viaunique_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:
getBody()now returns by value), and the removal of legacy APIs.get,post,putnow returnuint32_tand accept updated callback types). [1] [2]Documentation and Example Consistency:
Other improvements:
These changes modernize the library's API, improve safety and clarity, and provide clear migration guidance for users upgrading from v1 to v2.