mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
netdb: Add http and https service entries
getaddrinfo() and getservbyname() use the built-in service table when
resolving service names. The table only contained ntp, so common
service names such as http and https could not be resolved without a
numeric port.
Add http and https entries for both TCP and UDP to match the existing
service table style.
Testing:
- Host: Ubuntu 22.04 x86_64.
- Board/config: sim:nsh with CONFIG_LIBC_NETDB=y and
CONFIG_EXAMPLES_HELLO=y.
- make clean && make -j16.
- Ran a temporary hello example that called getservbyname("http",
"tcp") and getservbyname("https", "tcp"). The app verified ports
80 and 443 and printed "getservbyname http/https test passed".
Assisted-by: Claude:Claude-Fable-5
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
parent
5b9707cb5c
commit
2a934fbfba
1 changed files with 4 additions and 0 deletions
|
|
@ -46,6 +46,10 @@
|
|||
|
||||
const struct services_db_s g_services_db[] =
|
||||
{
|
||||
{ "http", 80, IP_PROTO_TCP },
|
||||
{ "http", 80, IP_PROTO_UDP },
|
||||
{ "https", 443, IP_PROTO_TCP },
|
||||
{ "https", 443, IP_PROTO_UDP },
|
||||
{ "ntp", 123, IP_PROTO_TCP },
|
||||
{ "ntp", 123, IP_PROTO_UDP },
|
||||
{ NULL, 0, 0 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue