SchemesConfig.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
14 static void
15 addUnique(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 
25 void
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) {
43  return Auth::SchemeConfig::GetParsed(s.c_str());
44  });
45 }
46 
static void addUnique(const SBuf &scheme, std::vector< SBuf > &vec)
Definition: SBuf.h:87
static SchemeConfig * GetParsed(const char *proxy_auth)
Definition: SchemeConfig.cc:69
bool isEmpty() const
Definition: SBuf.h:422
SBuf::size_type skipAllTrailing(const CharacterSet &discardables)
Definition: Tokenizer.cc:193
SBuf schemes
raw auth schemes list (may have duplicates)
Definition: SchemesConfig.h:37
static const CharacterSet HTAB
Definition: CharacterSet.h:87
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:17
Auth::Config TheConfig
Definition: stub_libauth.cc:21
const SBuf & remaining() const
the remaining unprocessed section of buffer
Definition: Tokenizer.h:44
static const CharacterSet SP
Definition: CharacterSet.h:91
bool token(SBuf &returnedToken, const CharacterSet &delimiters)
Definition: Tokenizer.cc:61
Auth::ConfigVector authConfigs
corresponding vector of Auth::Config objects
Definition: SchemesConfig.h:33

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors