/*
- * $Id: HttpBody.cc,v 1.24 2005/09/17 05:50:07 wessels Exp $
+ * $Id: HttpBody.cc,v 1.25 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 56 HTTP Message Body
* AUTHOR: Alex Rousskov
if (body->mb->contentSize())
packerAppend(p, body->mb->content(), body->mb->contentSize());
}
-
-#if UNUSED_CODE
-const char *
-httpBodyPtr(const HttpBody * body)
-{
- return body->mb->content() ? body->mb->content() : "";
-}
-
-#endif
/*
- * $Id: HttpHeaderTools.cc,v 1.56 2006/09/03 05:30:40 hno Exp $
+ * $Id: HttpHeaderTools.cc,v 1.57 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 66 HTTP Header Tools
* AUTHOR: Alex Rousskov
#include "ACLChecklist.h"
#include "MemBuf.h"
-#if UNUSED_CODE
-static int httpHeaderStrCmp(const char *h1, const char *h2, int len);
-#endif
static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs);
* implementaion is equavalent to strstr()! Thus, we replace the loop with
* strstr() above until strnstr() is available.
*/
-
-#ifdef BROKEN_CODE
-
- const char *pos = NULL;
- const char *item;
- assert(list && s);
-
- while (strListGetItem(list, del, &item, NULL, &pos)) {
- if (strstr(item, s))
- return 1;
- }
-
- return 0;
-#endif
}
/* appends an item to the list */
}
}
-/*
- * parses a given string then packs compiled headers and compares the result
- * with the original, reports discrepancies
- */
-#if UNUSED_CODE
-void
-httpHeaderTestParser(const char *hstr)
-{
- static int bug_count = 0;
- int hstr_len;
- int parse_success;
- HttpHeader hdr(hoReply);
- int pos;
- Packer p;
- MemBuf mb;
- assert(hstr);
- /* skip start line if any */
-
- if (!strncasecmp(hstr, "HTTP/", 5)) {
- const char *p = strchr(hstr, '\n');
-
- if (p)
- hstr = p + 1;
- }
-
- /* skip invalid first line if any */
- if (xisspace(*hstr)) {
- const char *p = strchr(hstr, '\n');
-
- if (p)
- hstr = p + 1;
- }
-
- hstr_len = strlen(hstr);
- /* skip terminator if any */
-
- if (strstr(hstr, "\n\r\n"))
- hstr_len -= 2;
- else if (strstr(hstr, "\n\n"))
- hstr_len -= 1;
-
- /* Debug::Levels[55] = 8; */
- parse_success = httpHeaderParse(&hdr, hstr, hstr + hstr_len);
-
- /* Debug::Levels[55] = 2; */
- if (!parse_success) {
- debug(66, 2) ("TEST (%d): failed to parsed a header: {\n%s}\n", bug_count, hstr);
- return;
- }
-
- /* we think that we parsed it, veryfy */
- mb.init();
-
- packerToMemInit(&p, &mb);
-
- httpHeaderPackInto(&hdr, &p);
-
- if ((pos = abs(httpHeaderStrCmp(hstr, mb.buf, hstr_len)))) {
- bug_count++;
- debug(66, 2) ("TEST (%d): hdr parsing bug (pos: %d near '%s'): expected: {\n%s} got: {\n%s}\n",
- bug_count, pos, hstr + pos, hstr, mb.buf);
- }
-
- hdr.clean();
- packerClean(&p);
- mb.clean();
-}
-
-#endif
-
-
-/* like strncasecmp but ignores ws characters */
-#if UNUSED_CODE
-static int
-httpHeaderStrCmp(const char *h1, const char *h2, int len)
-{
- int len1 = 0;
- int len2 = 0;
- assert(h1 && h2);
- /* fast check first */
-
- if (!strncasecmp(h1, h2, len))
- return 0;
-
- while (1) {
- const char c1 = xtoupper(h1[len1 += xcountws(h1 + len1)]);
- const char c2 = xtoupper(h2[len2 += xcountws(h2 + len2)]);
-
- if (c1 < c2)
- return -len1;
-
- if (c1 > c2)
- return +len1;
-
- if (!c1 && !c2)
- return 0;
-
- if (c1)
- len1++;
-
- if (c2)
- len2++;
- }
-
- /* NOTREACHED */
- return 0;
-}
-
-#endif
-
/*
* httpHdrMangle checks the anonymizer (header_access) configuration.
* Returns 1 if the header is allowed.
/*
- * $Id: HttpReply.cc,v 1.91 2007/04/06 04:50:04 rousskov Exp $
+ * $Id: HttpReply.cc,v 1.92 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 58 HTTP Reply (Response)
* AUTHOR: Alex Rousskov
httpStatusLineClean(&sline);
}
-#if OLD
-/* absorb: copy the contents of a new reply to the old one, destroy new one */
-void
-HttpReply::absorb(HttpReply * new_rep)
-{
- assert(new_rep);
- clean();
- *this = *new_rep;
- new_rep->header.entries.clean();
- /* cannot use Clean() on new reply now! */
- new_rep->do_clean = false;
- new_rep->cache_control = NULL; // helps with debugging
- delete new_rep;
-}
-
-#endif
-
void
HttpReply::packHeadersInto(Packer * p) const
{
/*
- * $Id: MemObject.h,v 1.13 2006/08/21 00:50:41 robertc Exp $
+ * $Id: MemObject.h,v 1.14 2007/04/20 07:29:47 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
void kickReads();
private:
-#if OLD
- /* Read only - this reply must be preserved by store clients */
- /* The original reply. possibly with updated metadata. */
- HttpReply const *_reply;
-#else
-
HttpReply *_reply;
-#endif
DeferredReadManager deferredReads;
};
/*
- * $Id: cache_cf.cc,v 1.508 2007/04/15 14:46:12 serassio Exp $
+ * $Id: cache_cf.cc,v 1.509 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
static void parse_http_port_list(http_port_list **);
static void dump_http_port_list(StoreEntry *, const char *, const http_port_list *);
static void free_http_port_list(http_port_list **);
-#if UNUSED_CODE
-static int check_null_http_port_list(const http_port_list *);
-#endif
#if USE_SSL
static void parse_https_port_list(https_port_list **);
static void dump_https_port_list(StoreEntry *, const char *, const https_port_list *);
}
}
-#if UNUSED_CODE
-static void
-dump_ushortlist(StoreEntry * entry, const char *name, ushortlist * u)
-{
- while (u) {
- storeAppendPrintf(entry, "%s %d\n", name, (int) u->i);
- u = u->next;
- }
-}
-
-static int
-check_null_ushortlist(ushortlist * u)
-{
- return u == NULL;
-}
-
-static void
-parse_ushortlist(ushortlist ** P)
-{
- char *token;
- u_short i;
- ushortlist *u;
- ushortlist **U;
-
- while ((token = strtok(NULL, w_space))) {
- i = GetShort();
- u = xcalloc(1, sizeof(ushortlist));
- u->i = i;
-
- for (U = P; *U; U = &(*U)->next)
-
- ;
- *U = u;
- }
-}
-
-static void
-free_ushortlist(ushortlist ** P)
-{
- ushortlist *u;
-
- while ((u = *P) != NULL) {
- *P = u->next;
- xfree(u);
- }
-}
-
-#endif
-
static void
dump_int(StoreEntry * entry, const char *name, int var)
{
safe_free(pattern);
}
-#if UNUSED_CODE
-static int
-check_null_refreshpattern(refresh_t * data)
-{
- return data == NULL;
-}
-
-#endif
-
static void
free_refreshpattern(refresh_t ** head)
{
}
}
-#if UNUSED_CODE
-static int
-check_null_http_port_list(const http_port_list * s)
-{
- return NULL == s;
-}
-
-#endif
-
#if USE_SSL
static void
cbdataFree_https_port(void *data)
/*
- * $Id: client_side.cc,v 1.748 2007/04/17 06:07:50 wessels Exp $
+ * $Id: client_side.cc,v 1.749 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
static void clientUpdateSocketStats(log_type logType, size_t size);
char *skipLeadingSpace(char *aString);
-#if UNUSED_CODE
-static void trimTrailingSpaces(char *aString, size_t len);
-#endif
static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno);
static int connFinishedWithConn(ConnStateData::Pointer& conn, int size);
static void connNoteUseOfBuffer(ConnStateData* conn, size_t byteCount);
return NULL;
}
-#if UNUSED_CODE
-void
-trimTrailingSpaces(char *aString, size_t len)
-{
- char *endPointer = aString + len;
-
- while (endPointer > aString && xisspace(*endPointer))
- *(endPointer--) = '\0';
-}
-
-#endif
-
void
setLogUri(ClientHttpRequest * http, char const *uri)
{
/*
- * $Id: enums.h,v 1.255 2007/04/13 22:46:03 wessels Exp $
+ * $Id: enums.h,v 1.256 2007/04/20 07:29:47 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
ENTRY_VALIDATED,
ENTRY_BAD_LENGTH,
ENTRY_ABORTED
-#if UNUSED_CODE
- ENTRY_DONT_LOG
-#endif
};
/*
/*
- * $Id: http.h,v 1.27 2007/04/06 04:50:06 rousskov Exp $
+ * $Id: http.h,v 1.28 2007/04/20 07:29:47 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
* getReply() public only because it is called from a static function
* as httpState->getReply()
*/
-#if OLD
-const HttpReply * getReply() const { return reply ? reply : entry->getReply(); }
-
-#else
const HttpReply * getReply() const { assert(reply); return reply; }
-#endif
-
private:
enum ConnectionStatus {
INCOMPLETE_MSG,
/*
- * $Id: mem.cc,v 1.102 2007/04/12 19:37:23 wessels Exp $
+ * $Id: mem.cc,v 1.103 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 13 High Level Memory Pool Management
* AUTHOR: Harvest Derived
}
}
-#if UNUSED_CODE
-/* to-do: make debug level a parameter? */
-static void memPoolDescribe(const MemAllocator * pool);
-static void
-memPoolDescribe(const MemAllocator * pool)
-{
- assert(pool);
- debug(13, 2) ("%-20s: %6d x %4d bytes = %5d KB\n",
- pool->label, memPoolInUseCount(pool), pool->obj_size,
- toKB(pool->obj_size * pool->meter.inuse.level));
-}
-
-#endif
-
void
memClean(void)
{
/*
- * $Id: neighbors.cc,v 1.344 2007/02/05 15:16:31 hno Exp $
+ * $Id: neighbors.cc,v 1.345 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 15 Neighbor Routines
* AUTHOR: Harvest Derived
return count;
}
-#if UNUSED_CODE
-peer *
-getSingleParent(HttpRequest * request)
-{
- peer *p = NULL;
- peer *q = NULL;
-
- for (q = Config.peers; q; q = q->next) {
- if (!peerHTTPOkay(q, request))
- continue;
-
- if (neighborType(q, request) != PEER_PARENT)
- return NULL; /* oops, found SIBLING */
-
- if (p)
- return NULL; /* oops, found second parent */
-
- p = q;
- }
-
- if (p != NULL && !p->options.no_query)
- return NULL;
-
- debug(15, 3) ("getSingleParent: returning %s\n", p ? p->host : "NULL");
-
- return p;
-}
-
-#endif
-
peer *
getFirstUpParent(HttpRequest * request)
{
/*
- * $Id: snmp_core.cc,v 1.75 2006/09/22 02:48:51 hno Exp $
+ * $Id: snmp_core.cc,v 1.76 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 49 SNMP support
* AUTHOR: Glenn Chisholm
return (new_oid);
}
-#if UNUSED_CODE
-/*
- * Allocate space for, and copy, an OID. Returns new oid.
- */
-static oid *
-snmpOidDup(oid * A, snint ALen)
-{
- oid *Ans = xmalloc(sizeof(oid) * ALen);
- xmemcpy(Ans, A, (sizeof(oid) * ALen));
- return Ans;
-}
-
-#endif
-
/*
* Debug calls, prints out the OID for debugging purposes.
*/
/*
- * $Id: store_digest.cc,v 1.70 2006/08/21 00:50:41 robertc Exp $
+ * $Id: store_digest.cc,v 1.71 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 71 Store Digest Manager
* AUTHOR: Alex Rousskov
* idea: skip objects that are going to be purged before the next
* update.
*/
-#if OLD_UNUSED_CODE /* This code isn't applicable anymore, we can't fix it atm either :( */
- if ((squid_curtime + Config.digest.rebuild_period) - e->lastref > storeExpiredReferenceAge())
- return 0;
-
-#endif
-
return 1;
}
/*
- * $Id: store_log.cc,v 1.30 2007/04/17 06:07:50 wessels Exp $
+ * $Id: store_log.cc,v 1.31 2007/04/20 07:29:47 wessels Exp $
*
* DEBUG: section 20 Storage Manager Logging Functions
* AUTHOR: Duane Wessels
if (NULL == storelog)
return;
-#if UNUSED_CODE
-
- if (EBIT_TEST(e->flags, ENTRY_DONT_LOG))
- return;
-
-#endif
-
storeLogTagsCounts[tag]++;
if (mem != NULL) {
if (mem->log_url == NULL) {