};
+/// \ingroup CacheManagerInternal
+typedef struct
+{
+ StoreEntry *entry;
+ char *action;
+ char *user_name;
+ char *passwd;
+} cachemgrStateData;
+
/**
\ingroup CacheManagerAPI
* a CacheManager - the menu system for interacting with squid.
virtual void registerAction(char const * action, char const * desc, OBJH * handler, int pw_req_flag, int atomic);
virtual CacheManagerAction * findAction(char const * action);
+ virtual void Start(int fd, HttpRequest * request, StoreEntry * entry);
+
static CacheManager* GetInstance();
protected:
CacheManager();
+ virtual cachemgrStateData* ParseUrl(const char *url);
+ virtual void ParseHeaders(cachemgrStateData * mgr, const HttpRequest * request);
private:
static CacheManager* instance;
/// \ingroup CacheManagerInternal
#define MGR_PASSWD_SZ 128
-/// \ingroup CacheManagerInternal
-typedef struct
-{
- StoreEntry *entry;
- char *action;
- char *user_name;
- char *passwd;
-} cachemgrStateData;
static CacheManagerAction *cachemgrFindAction(const char *action);
-static cachemgrStateData *cachemgrParseUrl(const char *url);
-static void cachemgrParseHeaders(cachemgrStateData * mgr, const HttpRequest * request);
static int cachemgrCheckPassword(cachemgrStateData *);
static void cachemgrStateFree(cachemgrStateData * mgr);
static char *cachemgrPasswdGet(cachemgr_passwd *, const char *);
}
/// \ingroup CacheManagerInternal
-static cachemgrStateData *
-cachemgrParseUrl(const char *url)
+cachemgrStateData *
+CacheManager::ParseUrl(const char *url)
{
int t;
LOCAL_ARRAY(char, host, MAX_URL);
#endif
} else if ((a = cachemgrFindAction(request)) == NULL) {
- debugs(16, 1, "cachemgrParseUrl: action '" << request << "' not found");
+ debugs(16, 1, "CacheManager::ParseUrl: action '" << request << "' not found");
return NULL;
} else {
prot = cachemgrActionProtection(a);
if (!strcmp(prot, "disabled") || !strcmp(prot, "hidden")) {
- debugs(16, 1, "cachemgrParseUrl: action '" << request << "' is " << prot);
+ debugs(16, 1, "CacheManager::ParseUrl: action '" << request << "' is " << prot);
return NULL;
}
}
}
/// \ingroup CacheManagerInternal
-static void
-cachemgrParseHeaders(cachemgrStateData * mgr, const HttpRequest * request)
+void
+CacheManager::ParseHeaders(cachemgrStateData * mgr, const HttpRequest * request)
{
const char *basic_cookie; /* base 64 _decoded_ user:passwd pair */
const char *passwd_del;
return;
if (!(passwd_del = strchr(basic_cookie, ':'))) {
- debugs(16, 1, "cachemgrParseHeaders: unknown basic_cookie format '" << basic_cookie << "'");
+ debugs(16, 1, "CacheManager::ParseHeaders: unknown basic_cookie format '" << basic_cookie << "'");
return;
}
mgr->passwd = xstrdup(passwd_del + 1);
/* warning: this prints decoded password which maybe not what you want to do @?@ @?@ */
- debugs(16, 9, "cachemgrParseHeaders: got user: '" << mgr->user_name << "' passwd: '" << mgr->passwd << "'");
+ debugs(16, 9, "CacheManager::ParseHeaders: got user: '" << mgr->user_name << "' passwd: '" << mgr->passwd << "'");
}
/**
// API
void
-cachemgrStart(int fd, HttpRequest * request, StoreEntry * entry)
+CacheManager::Start(int fd, HttpRequest * request, StoreEntry * entry)
{
cachemgrStateData *mgr = NULL;
ErrorState *err = NULL;
CacheManagerAction *a;
debugs(16, 3, "objectcacheStart: '" << entry->url() << "'" );
- if ((mgr = cachemgrParseUrl(entry->url())) == NULL) {
+ if ((mgr = ParseUrl(entry->url())) == NULL) {
err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND, request);
err->url = xstrdup(entry->url());
errorAppendEntry(entry, err);
debugs(16, 5, "CACHEMGR: " << fd_table[fd].ipaddr << " requesting '" << mgr->action << "'");
/* get additional info from request headers */
- cachemgrParseHeaders(mgr, request);
+ ParseHeaders(mgr, request);
/* Check password */