URL Components

Overview

net_url_parse() splits a URL into its scheme, user information, host, port, path, query and fragment. The components are offsets into the parsed string, so no copy is made and the caller decides which components it needs and how much memory to give them.

net_url_field_copy() copies one component into a NUL-terminated buffer, and net_url_target_copy() copies the request target of an HTTP request, the path and the query. net_url_scheme_is() compares the scheme without regard to case, and net_url_has_port() tells whether the URL names a port, so that the caller can fall back to the default port of the scheme.

The helpers are enabled with CONFIG_NET_URL, which selects the parser they are built on.

API Reference

URL components