UriUtil.hxx 1.57 KB
Newer Older
1
/*
Max Kellermann's avatar
Max Kellermann committed
2
 * Copyright (C) 2003-2013 The Music Player Daemon Project
3 4 5 6 7 8 9 10 11 12 13
 * http://www.musicpd.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
14 15 16 17
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 19
 */

Max Kellermann's avatar
Max Kellermann committed
20 21
#ifndef MPD_URI_UTIL_HXX
#define MPD_URI_UTIL_HXX
22

23
#include "Compiler.h"
24

25 26
#include <string>

27
/**
28
 * Checks whether the specified URI has a scheme in the form
29 30
 * "scheme://".
 */
31
gcc_pure
32 33
bool uri_has_scheme(const char *uri);

34
gcc_pure
35 36 37
const char *
uri_get_suffix(const char *uri);

38 39 40 41 42 43 44 45
/**
 * Returns true if this is a safe "local" URI:
 *
 * - non-empty
 * - does not begin or end with a slash
 * - no double slashes
 * - no path component begins with a dot
 */
46
gcc_pure
47 48 49
bool
uri_safe_local(const char *uri);

50 51 52
/**
 * Removes HTTP username and password from the URI.  This may be
 * useful for displaying an URI without disclosing secrets.  Returns
53 54
 * an empty string if nothing needs to be removed, or if the URI is
 * not recognized.
55
 */
56 57
gcc_pure
std::string
58 59
uri_remove_auth(const char *uri);

60
#endif