util/UriExtract: add uri_is_relative_path()

This commit is contained in:
Max Kellermann 2019-09-07 23:57:33 +02:00
parent 0b956cf968
commit 0509472636
2 changed files with 10 additions and 0 deletions

View File

@ -95,6 +95,12 @@ uri_get_scheme(const char *uri) noexcept
return {uri, end};
}
bool
uri_is_relative_path(const char *uri) noexcept
{
return !uri_has_scheme(uri) && *uri != '/';
}
const char *
uri_get_path(const char *uri) noexcept
{

View File

@ -49,6 +49,10 @@ gcc_pure
StringView
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
* given URI has no path.