Commit 05094726 authored by Max Kellermann's avatar Max Kellermann

util/UriExtract: add uri_is_relative_path()

parent 0b956cf9
...@@ -95,6 +95,12 @@ uri_get_scheme(const char *uri) noexcept ...@@ -95,6 +95,12 @@ uri_get_scheme(const char *uri) noexcept
return {uri, end}; return {uri, end};
} }
bool
uri_is_relative_path(const char *uri) noexcept
{
return !uri_has_scheme(uri) && *uri != '/';
}
const char * const char *
uri_get_path(const char *uri) noexcept uri_get_path(const char *uri) noexcept
{ {
......
...@@ -49,6 +49,10 @@ gcc_pure ...@@ -49,6 +49,10 @@ gcc_pure
StringView StringView
uri_get_scheme(const char *uri) noexcept; uri_get_scheme(const char *uri) noexcept;
gcc_pure
bool
uri_is_relative_path(const char *uri) noexcept;
/** /**
* Returns the URI path (including the query string) or nullptr if the * Returns the URI path (including the query string) or nullptr if the
* given URI has no path. * given URI has no path.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment