#include "icmp/net_db.h"
#include "ip/tools.h"
#include "md5.h"
+#include "mem/forward.h"
#include "MemBuf.h"
#include "refresh.h"
#include "SquidConfig.h"
#include "tools.h"
#include "URL.h"
-/** htcpDetail uses explicit alloc()/freeOne()
- * XXX: convert to MEMPROXY_CLASS() API
- */
-#include "mem/Pool.h"
-
typedef struct _Countstr Countstr;
typedef struct _htcpHeader htcpHeader;
typedef struct _htcpAuthHeader htcpAuthHeader;
-typedef struct _htcpDetail htcpDetail;
-
struct _Countstr {
uint16_t length;
char *text;
htcpDataHeader *dhdr;
};
-struct _htcpDetail {
+class htcpDetail {
+ MEMPROXY_CLASS(htcpDetail);
+public:
+ htcpDetail() : resp_hdrs(nullptr), respHdrsSz(0), entity_hdrs(nullptr), entityHdrsSz(0), cache_hdrs(nullptr), cacheHdrsSz(0) {}
char *resp_hdrs;
size_t respHdrsSz;
static cache_key queried_keys[N_QUERIED_KEYS][SQUID_MD5_DIGEST_LENGTH];
static Ip::Address queried_addr[N_QUERIED_KEYS];
-static MemAllocator *htcpDetailPool = NULL;
static int old_squid_format = 0;
static ssize_t htcpBuildSpecifier(char *buf, size_t buflen, htcpStuff * stuff);
static ssize_t htcpBuildTstOpData(char *buf, size_t buflen, htcpStuff * stuff);
static void htcpFreeSpecifier(htcpSpecifier * s);
-static void htcpFreeDetail(htcpDetail * s);
static void htcpHandleMsg(char *buf, int sz, Ip::Address &from);
delete s;
}
-static void
-htcpFreeDetail(htcpDetail * d)
-{
- htcpDetailPool->freeOne(d);
-}
-
/*
* Unpack an HTCP SPECIFIER in place
* This will overwrite any following AUTH block
static htcpDetail *
htcpUnpackDetail(char *buf, int sz)
{
- htcpDetail *d = static_cast<htcpDetail *>(htcpDetailPool->alloc());
+ htcpDetail *d = new htcpDetail;
/* Find length of RESP-HDRS */
uint16_t l = ntohs(*(uint16_t *) buf);
if (l > sz) {
debugs(31, 3, "htcpUnpackDetail: failed to unpack RESP_HDRS");
- htcpFreeDetail(d);
+ delete d;
return NULL;
}
if (l > sz) {
debugs(31, 3, "htcpUnpackDetail: failed to unpack ENTITY_HDRS");
- htcpFreeDetail(d);
+ delete d;
return NULL;
}
if (l > sz) {
debugs(31, 3, "htcpUnpackDetail: failed to unpack CACHE_HDRS");
- htcpFreeDetail(d);
+ delete d;
return NULL;
}
neighborsHtcpReply(key, &htcpReply, from);
htcpReply.hdr.clean();
- if (d)
- htcpFreeDetail(d);
+ delete d;
}
static void
debugs(31, DBG_IMPORTANT, "Sending HTCP messages from " << htcpOutgoingConn->local);
}
- if (!htcpDetailPool) {
- htcpDetailPool = memPoolCreate("htcpDetail", sizeof(htcpDetail));
- }
}
static void