ErrorDetailManager.h
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 #ifndef SQUID_SRC_SSL_ERRORDETAILMANAGER_H
10 #define SQUID_SRC_SSL_ERRORDETAILMANAGER_H
11 
12 #include "base/RefCount.h"
13 #include "HttpRequest.h"
14 #include "sbuf/SBuf.h"
15 #include "ssl/support.h"
16 
17 #include <map>
18 
19 class HttpRequest;
20 
21 namespace Ssl
22 {
23 
25 {
26 public:
28  ErrorDetailEntry(const SBuf &aName, const HttpHeader &);
29 
33 };
34 
40 {
41 public:
43 
47 
49  typedef std::map<Security::ErrorCode, ErrorDetailEntry> ErrorDetails;
51 };
52 
58 {
59 public:
61 
63  static void Shutdown();
64 
72  const ErrorDetailEntry *findDetail(Security::ErrorCode value, const HttpRequest::Pointer &request) const;
73 
78 
79 private:
81  ErrorDetailsList::Pointer getCachedDetails(const char *lang) const;
83  void cacheDetails(const ErrorDetailsList::Pointer &errorDetails) const;
84 
85  using Cache = std::map<SBuf, ErrorDetailsList::Pointer>;
86  mutable Cache cache;
88 
91 };
92 
94 void errorDetailClean();
95 } //namespace Ssl
96 #endif /* SQUID_SRC_SSL_ERRORDETAILMANAGER_H */
97 
int ErrorCode
Squid-defined error code (<0), an error code returned by X.509 API, or zero.
Definition: forward.h:131
ErrorDetails theList
The list of error details entries.
RefCount< ErrorDetailsList > Pointer
Definition: SBuf.h:93
ErrorDetailEntry(const SBuf &aName, const HttpHeader &)
extracts quoted detail and descr fields from the given header
std::map< SBuf, ErrorDetailsList::Pointer > Cache
static ErrorDetailsManager * TheDetailsManager
An instance of ErrorDetailsManager to be used by squid (ssl/ErrorDetails.*)
void errorDetailInitialize()
const ErrorDetailEntry * findRecord(Security::ErrorCode) const
std::map< Security::ErrorCode, ErrorDetailEntry > ErrorDetails
void errorDetailClean()
SBuf errLanguage
The language of the error-details.txt template, if any.
ErrorDetailsList::Pointer getCachedDetails(const char *lang) const
Return cached error details list for a given language if exist.
Definition: Xaction.cc:39
const ErrorDetailEntry * findDefaultDetail(Security::ErrorCode) const
static void Shutdown()
reset the ErrorDetailsManager instance
SBuf descr
short error description (for use in debug messages or error pages)
static ErrorDetailsManager & GetInstance()
Instance class.
SBuf detail
for error page D macro expansion; may contain macros
const ErrorDetailEntry * findDetail(Security::ErrorCode value, const HttpRequest::Pointer &request) const
void cacheDetails(const ErrorDetailsList::Pointer &errorDetails) const
cache the given error details list.
ErrorDetailsList::Pointer theDefaultErrorDetails
the default error details list
Cache cache
the error details list cache
SBuf name
a name for the error

 

Introduction

Documentation

Support

Miscellaneous