diff --git a/src/util/UriExtract.cxx b/src/util/UriExtract.cxx index c71019bcb..3a0e356ce 100644 --- a/src/util/UriExtract.cxx +++ b/src/util/UriExtract.cxx @@ -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 { diff --git a/src/util/UriExtract.hxx b/src/util/UriExtract.hxx index 628fe6f90..1d96e6fc8 100644 --- a/src/util/UriExtract.hxx +++ b/src/util/UriExtract.hxx @@ -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.