]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/web-util.c
eaff736665798fa79751cfa81472a288afb74759
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd.
5 Copyright 2010 Lennart Poettering
10 #include "string-util.h"
14 bool http_etag_is_valid(const char *etag
) {
18 if (!endswith(etag
, "\""))
21 if (!startswith(etag
, "\"") && !startswith(etag
, "W/\""))
27 bool http_url_is_valid(const char *url
) {
33 p
= startswith(url
, "http://");
35 p
= startswith(url
, "https://");
42 return ascii_is_valid(p
);
45 bool documentation_url_is_valid(const char *url
) {
51 if (http_url_is_valid(url
))
54 p
= startswith(url
, "file:/");
56 p
= startswith(url
, "info:");
58 p
= startswith(url
, "man:");
63 return ascii_is_valid(p
);