Squid Web Cache master
Loading...
Searching...
No Matches
ErrorDetailManager.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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
19class HttpRequest;
20
21namespace Ssl
22{
23
25{
26public:
28 ErrorDetailEntry(const SBuf &aName, const HttpHeader &);
29
33};
34
40{
41public:
43
47
49 typedef std::map<Security::ErrorCode, ErrorDetailEntry> ErrorDetails;
51};
52
58{
59public:
61
63 static void Shutdown();
64
72 const ErrorDetailEntry *findDetail(Security::ErrorCode value, const HttpRequest::Pointer &request) const;
73
78
79private:
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
94void errorDetailClean();
95} //namespace Ssl
96#endif /* SQUID_SRC_SSL_ERRORDETAILMANAGER_H */
97
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition Lock.h:66
Definition SBuf.h:94
SBuf detail
for error page D macro expansion; may contain macros
SBuf name
a name for the error
SBuf descr
short error description (for use in debug messages or error pages)
RefCount< ErrorDetailsList > Pointer
std::map< Security::ErrorCode, ErrorDetailEntry > ErrorDetails
SBuf errLanguage
The language of the error-details.txt template, if any.
const ErrorDetailEntry * findRecord(Security::ErrorCode) const
ErrorDetails theList
The list of error details entries.
static void Shutdown()
reset the ErrorDetailsManager instance
ErrorDetailsList::Pointer getCachedDetails(const char *lang) const
Return cached error details list for a given language if exist.
const ErrorDetailEntry * findDefaultDetail(Security::ErrorCode) const
Cache cache
the error details list cache
static ErrorDetailsManager * TheDetailsManager
An instance of ErrorDetailsManager to be used by squid (ssl/ErrorDetails.*)
static ErrorDetailsManager & GetInstance()
Instance class.
void cacheDetails(const ErrorDetailsList::Pointer &errorDetails) const
cache the given error details list.
std::map< SBuf, ErrorDetailsList::Pointer > Cache
ErrorDetailsList::Pointer theDefaultErrorDetails
the default error details list
const ErrorDetailEntry * findDetail(Security::ErrorCode value, const HttpRequest::Pointer &request) const
int ErrorCode
Squid-defined error code (<0), an error code returned by X.509 API, or zero.
Definition forward.h:134
Definition Xaction.cc:40
void errorDetailClean()
void errorDetailInitialize()