Skip to content

222 fix native https client#223

Merged
AlixANNERAUD merged 5 commits intomainfrom
222-fix-native-https-client
Apr 24, 2026
Merged

222 fix native https client#223
AlixANNERAUD merged 5 commits intomainfrom
222-fix-native-https-client

Conversation

@AlixANNERAUD
Copy link
Copy Markdown
Contributor

@AlixANNERAUD AlixANNERAUD commented Apr 24, 2026

This pull request introduces support for an HTTP client device, refines device selection logic for web requests, and improves network stack polling behavior. It also adds several utility functions for HTTP handling and cleans up logging in the HTTP module. The most important changes are grouped below:

HTTP Client Device Support

  • Added a new HttpClientDevice to the shared drivers and registered it in both native and wasm example main files, enabling HTTP (non-TLS) client capabilities. (drivers/shared/src/devices/http_client.rs, drivers/shared/src/devices/mod.rs, examples/native/src/main.rs, examples/wasm/src/main.rs) [1] [2] [3]

Web Request Device Selection

  • Introduced the select_client_device_path function to choose between HTTP and HTTPS client devices based on the URL scheme, updated the web request command to use this logic, and added tests to verify correct device selection. (executables/shell/command_line/src/commands/web_request.rs) [1] [2] [3] [4]

HTTP Utilities and Error Handling

  • Added utility functions in http_common.rs for mapping network errors, splitting host and port, computing request length, and building serialized response headers. (drivers/shared/src/devices/http_common.rs)

Network Stack Improvements

  • Limited the network stack poll interval to a maximum of 20ms to improve responsiveness and resource usage. (modules/network/src/manager/runner.rs) [1] [2]
  • Improved TCP socket receive logic to correctly handle closed sockets when data is exhausted. (modules/network/src/socket/tcp.rs)

Codebase Cleanup

  • Removed excessive logging from the HTTP line iterator utility for cleaner logs and improved performance. (modules/shared/src/http/mod.rs)

Dependency Updates

  • Updated dependencies in Cargo.toml to add embassy-futures and fix the version for embedded-io-async. (drivers/shared/Cargo.toml)

- Added `http_common.rs` with functions for error mapping, host/port splitting, request length computation, and response header building.
- Refactored `https_client.rs` to utilize the new HTTP common utilities, improving code organization and readability.
- Updated the `HttpsClientContext` to manage state transitions more effectively and handle asynchronous operations.
- Introduced state management for request handling to prevent concurrent requests.
- Enhanced error handling and logging throughout the HTTPS client implementation.
@AlixANNERAUD AlixANNERAUD linked an issue Apr 24, 2026 that may be closed by this pull request
@AlixANNERAUD AlixANNERAUD enabled auto-merge (squash) April 24, 2026 21:49
@AlixANNERAUD AlixANNERAUD merged commit 415ec71 into main Apr 24, 2026
3 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix native http/s client

1 participant