SchemesConfig.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#include "squid.h"
10#include "auth/Config.h"
11#include "fatal.h"
12#include "parser/Tokenizer.h"
13
14static void
15addUnique(const SBuf &scheme, std::vector<SBuf> &vec)
16{
17 static const SBuf all("ALL");
18 if (scheme == all) {
19 for (const auto config: Auth::TheConfig.schemes)
20 addUnique(SBuf(config->type()), vec);
21 } else if (std::find(vec.begin(), vec.end(), scheme) == vec.end())
22 vec.push_back(scheme);
23}
24
25void
27{
28 static const CharacterSet delimiters("delimiters", ",");
29 static const CharacterSet quotedDelimiters("quotedDelimiters", ", ");
30 const CharacterSet *resultDelimiters = quoted ? &quotedDelimiters : &delimiters;
31 std::vector<SBuf> expanded;
33 SBuf scheme;
34 while (t.token(scheme, *resultDelimiters))
35 addUnique(scheme, expanded);
37 if (!t.remaining().isEmpty())
38 addUnique(t.remaining(), expanded);
39
40 authConfigs.clear();
41 transform(expanded.begin(), expanded.end(),
42 back_inserter(authConfigs), [](SBuf &s) {
44 });
45}
46
static void addUnique(const SBuf &scheme, std::vector< SBuf > &vec)
static SchemeConfig * GetParsed(const char *proxy_auth)
Definition: SchemeConfig.cc:70
SBuf schemes
raw auth schemes list (may have duplicates)
Definition: SchemesConfig.h:37
Auth::ConfigVector authConfigs
corresponding vector of Auth::Config objects
Definition: SchemesConfig.h:33
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:18
static const CharacterSet SP
Definition: CharacterSet.h:94
static const CharacterSet HTAB
Definition: CharacterSet.h:90
SBuf::size_type skipAllTrailing(const CharacterSet &discardables)
Definition: Tokenizer.cc:222
bool token(SBuf &returnedToken, const CharacterSet &delimiters)
Definition: Tokenizer.cc:61
const SBuf & remaining() const
the remaining unprocessed section of buffer
Definition: Tokenizer.h:44
Definition: SBuf.h:94
const char * c_str()
Definition: SBuf.cc:516
bool isEmpty() const
Definition: SBuf.h:431
Auth::Config TheConfig
Definition: Config.cc:15

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors