Skip to content

[SL-ONLY] Adds DNS lookup support for HTTPs client - #1279

Merged
Rohan Sahay (rosahay-silabs) merged 1 commit into
feature/add-mqtt-client-certsfrom
feature/add-http-dns-lookup
Oct 15, 2026
Merged

Rohan Sahay (rosahay-silabs) merged 1 commit into
feature/add-mqtt-client-certsfrom
feature/add-http-dns-lookup

Conversation

@rosahay-silabs

@rosahay-silabs Rohan Sahay (rosahay-silabs) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Update the Silicon Labs HttpClient to support hostname or IPv4-based server endpoints, eliminating the need to provide a separate server IP address and hostname.

  • Replace serverIp and hostName with serverEndpoint and optional tlsHostname. When omitted, tlsHostname defaults to serverEndpoint for HTTP Host and TLS SNI.
  • Introduce ResolveServerEndpoint() to resolve the server endpoint before each GET, POST, or PUT request:
    • Parse IPv4 literals using sl_net_inet_addr.
    • Resolve hostnames using sl_net_dns_resolve_hostname_v2 with a 5-second timeout and one retry.
  • Connect using the resolved IPv4 address while preserving the configured TLS hostname for the NWP stack.
  • Update the thermostat HTTPS offload example to use HTTP_SERVER_ENDPOINT and HTTP_TLS_HOSTNAME instead of HTTP_SERVER_IP and HTTP_HOSTNAME.

Related Issues

  • N/A

Testing

  • Verify HTTP GET, POST, and PUT requests using an IPv4 address.
  • Verify HTTPS connections using hostname-based DNS resolution.
  • Validate TLS hostname handling with both explicit and default tlsHostname configurations.
  • Verify DNS resolution failure and retry behavior.

@rosahay-silabs
Rohan Sahay (rosahay-silabs) added this pull request to stack #1247 October 14, 2026 18:52
@rosahay-silabs

Copy link
Copy Markdown
Contributor Author

bugbot review

@cursor

cursor Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes TLS connect and SNI wiring plus adds blocking DNS on the HttpClient service thread; HttpHost is an API break for Silabs callers still passing separate IP and hostname.

Overview
Silabs HttpClient now accepts a hostname or IPv4 for the connect target instead of requiring a separate IP and SNI name. HttpHost replaces serverIp / hostName with serverEndpoint and optional tlsHostname (defaults to serverEndpoint for Host/SNI when omitted).

Before each GET/POST/PUT, ResolveServerEndpoint() parses IPv4 literals via sl_net_inet_addr or performs blocking IPv4 DNS (sl_net_dns_resolve_hostname_v2, 5s timeout, one retry), then connects using the resolved ASCII IP while still sending the TLS hostname to the NWP stack.

The thermostat HTTPS offload example is updated to use HTTP_SERVER_ENDPOINT and HTTP_TLS_HOSTNAME build macros instead of HTTP_SERVER_IP / HTTP_HOSTNAME.

Reviewed by Cursor Bugbot for commit d792adf. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d792adf. Configure here.

Comment thread src/platform/silabs/services/http_client.cpp
@rosahay-silabs Rohan Sahay (rosahay-silabs) changed the title [SL-ONLY] Introduce ResolveServerEndpoint method for DNS resolution and improve… [SL-ONLY] Adds DNS lookup support for HTTPs client Oct 14, 2026
@rosahay-silabs
Rohan Sahay (rosahay-silabs) marked this pull request as ready for review October 14, 2026 18:59
@rosahay-silabs
Rohan Sahay (rosahay-silabs) requested a review from a team as a code owner October 14, 2026 18:59
@rosahay-silabs
Rohan Sahay (rosahay-silabs) merged commit 40768c7 into test/feature/add-matter-service Oct 15, 2026
15 checks passed
@rosahay-silabs
Rohan Sahay (rosahay-silabs) deleted the feature/add-http-dns-lookup branch October 15, 2026 12:00
Rohan Sahay (rosahay-silabs) added a commit that referenced this pull request Oct 15, 2026
Introduce ResolveServerEndpoint method for DNS resolution and improve SNI handling with tlsHostname.
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.

3 participants