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
27
28#include <regex>
29#include <string>
30#include <unordered_set>
31#include <vector>
32
36static inline bool is_subdirectory(const std::string& dir,
37 const std::string& subdir)
38{
39 if (subdir.size() < dir.size() || dir.empty())
40 return false;
41
42 if (subdir.compare(0, dir.size(), dir, 0, dir.size()) != 0)
43 return false;
44
45 return dir.size() == subdir.size() || subdir[dir.size()] == '/' || dir.back() == '/';
46}
47
55std::string obfuscateAuth(const std::string & input);
56
64void stripCgi(std::string& url, const std::unordered_set<std::string> &cgiKeys);
65void stripCgi(XrdOucString& url, const std::unordered_set<std::string> &cgiKeys);
66
67#endif //XROOTD_XRDOUCPRIVATEUTILS_HH
void stripCgi(std::string &url, const std::unordered_set< std::string > &cgiKeys)
static bool is_subdirectory(const std::string &dir, const std::string &subdir)
std::string obfuscateAuth(const std::string &input)