2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
// author: Max Kellermann <max.kellermann@gmail.com>
|
2019-08-09 15:54:13 +02:00
|
|
|
|
2022-07-01 10:50:32 +02:00
|
|
|
#pragma once
|
2019-08-09 15:54:13 +02:00
|
|
|
|
|
|
|
#include <string>
|
2020-03-13 17:47:26 +01:00
|
|
|
#include <string_view>
|
2019-08-09 15:54:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether #child specifies a resource "inside" the directory
|
|
|
|
* specified by #parent. If the strings are equal, the function
|
|
|
|
* returns false.
|
|
|
|
*/
|
2022-04-26 20:19:31 +02:00
|
|
|
[[gnu::pure]] [[gnu::nonnull]]
|
2019-08-09 15:54:13 +02:00
|
|
|
bool
|
|
|
|
uri_is_child(const char *parent, const char *child) noexcept;
|
|
|
|
|
2022-04-26 20:19:31 +02:00
|
|
|
[[gnu::pure]] [[gnu::nonnull]]
|
2019-08-09 15:54:13 +02:00
|
|
|
bool
|
|
|
|
uri_is_child_or_same(const char *parent, const char *child) noexcept;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate the given URI in the context of #base. For example,
|
|
|
|
* uri_apply_base("foo", "http://bar/a/")=="http://bar/a/foo".
|
|
|
|
*/
|
2022-04-26 20:19:31 +02:00
|
|
|
[[gnu::pure]]
|
2019-08-09 15:54:13 +02:00
|
|
|
std::string
|
2020-03-13 17:47:26 +01:00
|
|
|
uri_apply_base(std::string_view uri, std::string_view base) noexcept;
|
2019-08-09 15:54:13 +02:00
|
|
|
|
2022-04-26 20:19:31 +02:00
|
|
|
[[gnu::pure]]
|
2019-09-07 23:58:19 +02:00
|
|
|
std::string
|
2020-03-13 17:47:26 +01:00
|
|
|
uri_apply_relative(std::string_view relative_uri,
|
|
|
|
std::string_view base_uri) noexcept;
|