Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Htnuts #1962

Merged
merged 2 commits into from
Dec 7, 2024
Merged

Htnuts #1962

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/nng/nng.h
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,11 @@ NNG_DECL const char *nng_url_scheme(const nng_url *);
// the scheme.
NNG_DECL uint32_t nng_url_port(const nng_url *);

// Update a URL with a zero port to a non-zero port (useful
// after a bind to port 0). Does nothing if the URL's port is not
// zero to start with.
NNG_DECL void nng_url_resolve_port(nng_url *url, uint32_t port);

// hostname part of URL, can be NULL if irerelvant to scheme
const char *nng_url_hostname(const nng_url *);

Expand Down
8 changes: 8 additions & 0 deletions src/core/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,14 @@ nng_url_port(const nng_url *url)
return (url->u_port);
}

void
nng_url_resolve_port(nng_url *url, uint32_t port)
{
if (url->u_port == 0) {
url->u_port = port;
}
}

const char *
nng_url_hostname(const nng_url *url)
{
Expand Down
1 change: 1 addition & 0 deletions src/supplemental/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ nng_sources_if(NNG_SUPP_HTTP
http_public.c
http_schemes.c
http_server.c)
nng_test_if(NNG_SUPP_HTTP http_server_test)
Loading
Loading