]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/web-util.c
628f0805bd3f830ad5fc572f747c20d7498e7b48
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #include "string-util.h"
8 bool http_etag_is_valid(const char *etag
) {
12 if (!endswith(etag
, "\""))
15 if (!STARTSWITH_SET(etag
, "\"", "W/\""))
21 bool http_url_is_valid(const char *url
) {
27 p
= STARTSWITH_SET(url
, "http://", "https://");
34 return ascii_is_valid(p
);
37 bool file_url_is_valid(const char *url
) {
43 p
= startswith(url
, "file:/");
47 return ascii_is_valid(p
);
50 bool documentation_url_is_valid(const char *url
) {
56 if (http_url_is_valid(url
) || file_url_is_valid(url
))
59 p
= STARTSWITH_SET(url
, "info:", "man:");
63 return ascii_is_valid(p
);