XRootD
Loading...
Searching...
No Matches
XrdOucPrivateUtils.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2024-2025 by European Organization for Nuclear Research (CERN)
3// Author: Cedric Caffy <cedric.caffy@cern.ch>
4//------------------------------------------------------------------------------
5// XRootD is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// XRootD is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17//------------------------------------------------------------------------------
18
19
23#ifndef XROOTD_XRDOUCPRIVATEUTILS_HH
24#define XROOTD_XRDOUCPRIVATEUTILS_HH
25
26#include <regex>
27#include <string>
28#include <string_view>
29#include <vector>
30
34static inline bool is_subdirectory(const std::string_view dir,
35 const std::string_view subdir)
36{
37 if (subdir.size() < dir.size() || dir.empty())
38 return false;
39
40 if (subdir.compare(0, dir.size(), dir, 0, dir.size()) != 0)
41 return false;
42
43 return dir.size() == subdir.size() || subdir[dir.size()] == '/' || dir.back() == '/';
44}
45
53std::string obfuscateAuth(const std::string & input);
54
55#endif //XROOTD_XRDOUCPRIVATEUTILS_HH
static bool is_subdirectory(const std::string_view dir, const std::string_view subdir)
std::string obfuscateAuth(const std::string &input)