]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
removed lots of #if 0 code
authorwessels <>
Sat, 7 Mar 1998 06:22:23 +0000 (06:22 +0000)
committerwessels <>
Sat, 7 Mar 1998 06:22:23 +0000 (06:22 +0000)
14 files changed:
src/asn.cc
src/cache_manager.cc
src/debug.cc
src/defines.h
src/enums.h
src/ftp.cc
src/http.cc
src/main.cc
src/mime.cc
src/protos.h
src/snmp_agent.cc
src/store.cc
src/structs.h
src/urn.cc

index 0e70aec1eb7a5792460a30af1902fd81fc5e0887..91bd5b2e808579246092be9339ecfcfae7a2fcc8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: asn.cc,v 1.22 1998/03/03 00:31:00 rousskov Exp $
+ * $Id: asn.cc,v 1.23 1998/03/06 23:22:23 wessels Exp $
  *
  * DEBUG: section 53    AS Number handling
  * AUTHOR: Duane Wessels, Kostas Anagnostakis
@@ -231,7 +231,6 @@ asHandleReply(void *data, char *buf, ssize_t size)
            asState);
        return;
     }
-/* XXX do the processing here */
     s = buf;
     while (*s) {
        for (t = s; *t; t++) {
index 4b175ce1b00bd16dcf7e76b8ba29782467c20fb8..25574ddd4f922764c3b7ef419aa97febd7cda801 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_manager.cc,v 1.7 1998/02/26 18:00:37 wessels Exp $
+ * $Id: cache_manager.cc,v 1.8 1998/03/06 23:22:24 wessels Exp $
  *
  * DEBUG: section 16    Cache Manager Objects
  * AUTHOR: Duane Wessels
@@ -49,11 +49,7 @@ typedef struct _action_table {
 } action_table;
 
 static action_table *cachemgrFindAction(const char *action);
-#if 0
-static cachemgrStateData *cachemgrParse(const char *url);
-#else
 static cachemgrStateData *cachemgrParseUrl(const char *url);
-#endif
 static void cachemgrParseHeaders(cachemgrStateData * mgr, const request_t * request);
 static int cachemgrCheckPassword(cachemgrStateData *);
 static void cachemgrStateFree(cachemgrStateData * mgr);
@@ -212,33 +208,6 @@ cachemgrStart(int fd, request_t * request, StoreEntry * entry)
            fd_table[fd].ipaddr, mgr->action);
     /* Check password */
     if (cachemgrCheckPassword(mgr) != 0) {
-#if 0                          /* old response, we ask for authentication now */
-       cachemgrStateFree(mgr);
-       debug(16, 1) ("WARNING: Incorrect Cachemgr Password!\n");
-       err = errorCon(ERR_INVALID_URL, HTTP_NOT_FOUND);
-       errorAppendEntry(entry, err);
-#else
-       /* build error message */
-       ErrorState *err = errorCon(ERR_CACHE_MGR_ACCESS_DENIED, HTTP_UNAUTHORIZED);
-       HttpReply *rep;
-       /* warn if user specified incorrect password */
-       if (mgr->passwd)
-           debug(16, 1) ("WARNING: CACHEMGR: Incorrect Password (user: %s, action: %s)!\n",
-               mgr->user_name ? mgr->user_name : "<unknown>", mgr->action);
-       else
-           debug(16, 3) ("CACHEMGR: requesting authentication for action: '%s'.\n",
-               mgr->action);
-       err->request = requestLink(request);
-       rep = errorBuildReply(err);
-       errorStateFree(err);
-       /* add Authenticate header, use 'action' as a realm because password depends on action */
-       httpHeaderSetAuth(&rep->hdr, "Basic", mgr->action);
-       /* move info to the mem_obj->reply */
-       httpReplyAbsorb(entry->mem_obj->reply, rep);
-       /* store the reply */
-       httpReplySwapOut(entry->mem_obj->reply, entry);
-       cachemgrStateFree(mgr);
-#endif
        entry->expires = squid_curtime;
        storeComplete(entry);
        return;
@@ -254,16 +223,6 @@ cachemgrStart(int fd, request_t * request, StoreEntry * entry)
        httpReplySwapOut(rep, entry);
        httpReplyDestroy(rep);
     }
-#if 0
-    hdr = httpReplyHeader((double) 1.0,
-       HTTP_OK,
-       "text/plain",
-       -1,                     /* Content-Length */
-       squid_curtime,          /* LMT */
-       squid_curtime);
-    storeAppend(entry, hdr, strlen(hdr));
-    storeAppend(entry, "\r\n", 2);
-#endif
     a->handler(entry);
     storeBufferFlush(entry);
     storeComplete(entry);
index 14d7b44e05cd5edb193d6026ac19686d2d0edd77..aa91e8ba130057603aa347184c43d57de00660a7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: debug.cc,v 1.63 1998/02/26 17:57:45 wessels Exp $
+ * $Id: debug.cc,v 1.64 1998/03/06 23:22:25 wessels Exp $
  *
  * DEBUG: section 0     Debug Routines
  * AUTHOR: Harvest Derived
@@ -303,83 +303,74 @@ debugLogTime(time_t t)
 
 /*
  * Context-based Debugging
- */
-
-#if 0
-
-    /*
-     * Rationale
-     * ---------
-     * 
-     * When you have a long nested processing sequence, it is often impossible
-     * for low level routines to know in what larger context they operate. If a
-     * routine coredumps, one can restore the context using debugger trace.
-     * However, in many case you do not want to coredump, but just want to report
-     * a potential problem. A report maybe useless out of problem context.
-     * 
-     * To solve this potential problem, use the following approach:
-     */
-
-int
-top_level_foo(const char *url)
-{
-    /* define current context */
-    Ctx ctx = ctx_enter(url);  /* note: we stack but do not dup ctx descriptions! */
-    ...
-    /* go down; middle_level_bar will eventually call bottom_level_boo */
-       middle_level_bar(method, protocol);
-    ...
-    /* exit, clean after yourself */
-       ctx_exit(ctx);
-}
-
-void
-bottom_level_boo(int status, void *data)
-{
-    /*
-     * detect exceptional condition, and simply report it, the context
-     * information will be available somewhere close in the log file
-     */
-    if (status == STRANGE_STATUS)
-       debug(13, 6) ("DOS attack detected, data: %p\n", data);
-    ...
-}
-
-    /*
-     * Current implementation is extremely simple but still very handy. It has a
-     * negligible overhead (descriptions are not duplicated).
-     * 
-     * When the _first_ debug message for a given context is printed, it is
-     * prepended with the current context description. Context is printed with
-     * the same debugging level as the original message.
-     * 
-     * Note that we do not print context every type you do ctx_enter(). This
-     * approach would produce too many useless messages.  For the same reason, a
-     * context description is printed at most _once_ even if you have 10
-     * debugging messages within one context.
-     * 
-     * Contexts can be nested, of course. You must use ctx_enter() to enter a
-     * context (push it onto stack).  It is probably safe to exit several nested
-     * contexts at _once_ by calling ctx_exit() at the top level (this will pop
-     * all context till current one). However, as in any stack, you cannot start
-     * in the middle.
-     * 
-     * Analysis: 
-     * i)   locate debugging message,
-     * ii)  locate current context by going _upstream_ in your log file,
-     * iii) hack away.
-     */
-
-#endif /* rationale */
-
-/*
+ *
+ * Rationale
+ * ---------
+ * 
+ * When you have a long nested processing sequence, it is often impossible
+ * for low level routines to know in what larger context they operate. If a
+ * routine coredumps, one can restore the context using debugger trace.
+ * However, in many case you do not want to coredump, but just want to report
+ * a potential problem. A report maybe useless out of problem context.
+ * 
+ * To solve this potential problem, use the following approach:
+ * 
+ * int
+ * top_level_foo(const char *url)
+ * {
+ *      // define current context
+ *      // note: we stack but do not dup ctx descriptions!
+ *      Ctx ctx = ctx_enter(url);
+ *      ...
+ *      // go down; middle_level_bar will eventually call bottom_level_boo
+ *      middle_level_bar(method, protocol);
+ *      ...
+ *      // exit, clean after yourself
+ *      ctx_exit(ctx);
+ * }
+ * 
+ * void
+ * bottom_level_boo(int status, void *data)
+ * {
+ *      // detect exceptional condition, and simply report it, the context
+ *      // information will be available somewhere close in the log file
+ *      if (status == STRANGE_STATUS)
+ *      debug(13, 6) ("DOS attack detected, data: %p\n", data);
+ *      ...
+ * }
+ * 
+ * Current implementation is extremely simple but still very handy. It has a
+ * negligible overhead (descriptions are not duplicated).
+ * 
+ * When the _first_ debug message for a given context is printed, it is
+ * prepended with the current context description. Context is printed with
+ * the same debugging level as the original message.
+ * 
+ * Note that we do not print context every type you do ctx_enter(). This
+ * approach would produce too many useless messages.  For the same reason, a
+ * context description is printed at most _once_ even if you have 10
+ * debugging messages within one context.
+ * 
+ * Contexts can be nested, of course. You must use ctx_enter() to enter a
+ * context (push it onto stack).  It is probably safe to exit several nested
+ * contexts at _once_ by calling ctx_exit() at the top level (this will pop
+ * all context till current one). However, as in any stack, you cannot start
+ * in the middle.
+ * 
+ * Analysis: 
+ * i)   locate debugging message,
+ * ii)  locate current context by going _upstream_ in your log file,
+ * iii) hack away.
+ *
+ *
  * To-Do: 
+ * -----
+ *
  *       decide if we want to dup() descriptions (adds overhead) but allows to
  *       add printf()-style interface
- */
-
-/*
+ *
  * implementation:
+ * ---------------
  *
  * descriptions for contexts over CTX_MAX_LEVEL limit are ignored, you probably
  * have a bug if your nesting goes that deep.
index 5cfbddcca32544c85965389b3eb931e083a8a076..5894a17a9b939ffd4b1ea676801d0b91f2ef214d 100644 (file)
 /*  
  *  Here are some good prime number choices.  It's important not to
  *  choose a prime number that is too close to exact powers of 2.
+ *
+ *  HASH_SIZE 103              // prime number < 128
+ *  HASH_SIZE 229              // prime number < 256
+ *  HASH_SIZE 467              // prime number < 512
+ *  HASH_SIZE 977              // prime number < 1024
+ *  HASH_SIZE 1979             // prime number < 2048
+ *  HASH_SIZE 4019             // prime number < 4096
+ *  HASH_SIZE 6037             // prime number < 6144
+ *  HASH_SIZE 7951             // prime number < 8192
+ *  HASH_SIZE 12149            // prime number < 12288
+ *  HASH_SIZE 16231            // prime number < 16384
+ *  HASH_SIZE 33493            // prime number < 32768
+ *  HASH_SIZE 65357            // prime number < 65536
  */
-#if 0
-#undef  HASH_SIZE 103          /* prime number < 128 */
-#undef  HASH_SIZE 229          /* prime number < 256 */
-#undef  HASH_SIZE 467          /* prime number < 512 */
-#undef  HASH_SIZE 977          /* prime number < 1024 */
-#undef  HASH_SIZE 1979         /* prime number < 2048 */
-#undef  HASH_SIZE 4019         /* prime number < 4096 */
-#undef  HASH_SIZE 6037         /* prime number < 6144 */
-#undef  HASH_SIZE 7951         /* prime number < 8192 */
-#undef  HASH_SIZE 12149                /* prime number < 12288 */
-#undef  HASH_SIZE 16231                /* prime number < 16384 */
-#undef  HASH_SIZE 33493                /* prime number < 32768 */
-#undef  HASH_SIZE 65357                /* prime number < 65536 */
-#endif
 
 #define  DEFAULT_HASH_SIZE 7951        /* prime number < 8192 */
 
index a945233889a277797bc2066a9adda21e0f7528ee..f504afb26dc76d48eb75588330621bda90ce1aad 100644 (file)
@@ -473,11 +473,7 @@ typedef enum {
     MEM_FQDNCACHE_PENDING,
     MEM_HASH_LINK,
     MEM_HASH_TABLE,
-#if 0                          /* renamed to detect all old uses */
-    MEM_HTTP_REPLY,
-#else
     MEM_HTTPREPLY,
-#endif
     MEM_HTTP_HDR_CC,
     MEM_HTTP_HDR_RANGE_SPEC,
     MEM_HTTP_HDR_RANGE,
index dcf66a95fb7feb135fecf7a02a4e7732851dcca4..f8d3301c293b07c98f22d0b57363a87063ca12d0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.202 1998/03/06 05:43:36 kostas Exp $
+ * $Id: ftp.cc,v 1.203 1998/03/06 23:22:27 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -1746,8 +1746,9 @@ ftpReadStor(FtpStateData * ftpState)
       debug(9, 3) ("ftpReadStor: writing data channel\n");
       ftpState->state = WRITING_DATA;
     }
-    else if (code==553) { /* directory does not exist, have to create, sigh */
-#if 0
+    else if (code==553) {
+       /* directory does not exist, have to create, sigh */
+#if WORK_IN_PROGRESS
        ftpTraverseDirectory(ftpState);
 #endif
        ftpSendReply(ftpState);
index bfdad1baa7f3adf445ee28d587e7b6e3c2d852d6..0fc16efae506f56b8714c8123f0bd431986815a1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.247 1998/03/06 05:43:37 kostas Exp $
+ * $Id: http.cc,v 1.248 1998/03/06 23:22:28 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
 
 static const char *const crlf = "\r\n";
 
-#if 0                          /* moved to HttpHeader */
-typedef enum {
-    SCC_PUBLIC,
-    SCC_PRIVATE,
-    SCC_NOCACHE,
-    SCC_NOSTORE,
-    SCC_NOTRANSFORM,
-    SCC_MUSTREVALIDATE,
-    SCC_PROXYREVALIDATE,
-    SCC_MAXAGE,
-    SCC_ENUM_END
-} http_server_cc_t;
-
-#endif
-
 enum {
     CCC_NOCACHE,
     CCC_NOSTORE,
@@ -138,72 +123,6 @@ enum {
     CCC_ENUM_END
 };
 
-#if 0                          /* moved to HttpHeader.h */
-typedef enum {
-    HDR_ACCEPT,
-    HDR_AGE,
-    HDR_CONTENT_LENGTH,
-    HDR_CONTENT_MD5,
-    HDR_CONTENT_TYPE,
-    HDR_DATE,
-    HDR_ETAG,
-    HDR_EXPIRES,
-    HDR_HOST,
-    HDR_IMS,
-    HDR_LAST_MODIFIED,
-    HDR_MAX_FORWARDS,
-    HDR_PUBLIC,
-    HDR_RETRY_AFTER,
-    HDR_SET_COOKIE,
-    HDR_UPGRADE,
-    HDR_WARNING,
-    HDR_PROXY_KEEPALIVE,
-    HDR_MISC_END
-} http_hdr_misc_t;
-
-static char *HttpServerCCStr[] =
-{
-    "public",
-    "private",
-    "no-cache",
-    "no-store",
-    "no-transform",
-    "must-revalidate",
-    "proxy-revalidate",
-    "max-age",
-    "NONE"
-};
-
-static char *HttpHdrMiscStr[] =
-{
-    "Accept",
-    "Age",
-    "Content-Length",
-    "Content-MD5",
-    "Content-Type",
-    "Date",
-    "Etag",
-    "Expires",
-    "Host",
-    "If-Modified-Since",
-    "Last-Modified",
-    "Max-Forwards",
-    "Public",
-    "Retry-After",
-    "Set-Cookie",
-    "Upgrade",
-    "Warning",
-    "NONE"
-};
-
-static struct {
-    int parsed;
-    int misc[HDR_MISC_END];
-    int cc[SCC_ENUM_END];
-} ReplyHeaderStats;
-
-#endif /* if 0 */
-
 static CNCB httpConnectDone;
 static CWCB httpSendComplete;
 static void *sendHeaderDone;
@@ -217,9 +136,6 @@ static void httpAppendRequestHeader(char *hdr, const char *line, size_t * sz, si
 static void httpCacheNegatively(StoreEntry *);
 static void httpMakePrivate(StoreEntry *);
 static void httpMakePublic(StoreEntry *);
-#if 0                          /* moved to HttpResponse */
-static char *httpStatusString(int status);
-#endif
 static STABH httpAbort;
 static HttpStateData *httpBuildState(int, StoreEntry *, request_t *, peer *);
 static int httpSocketOpen(StoreEntry *, request_t *);
@@ -300,140 +216,6 @@ httpCacheNegatively(StoreEntry * entry)
        storeSetPublicKey(entry);
 }
 
-
-#if 0
-/* Build a reply structure from HTTP reply headers */
-void
-httpParseReplyHeaders(const char *buf, struct _http_reply *reply)
-{
-    char *headers = memAllocate(MEM_4K_BUF);
-    char *line;
-    char *end;
-    char *s = NULL;
-    char *t;
-    time_t delta;
-    size_t l;
-
-    assert(reply != NULL);
-    reply->code = 600;
-    ReplyHeaderStats.parsed++;
-    xstrncpy(headers, buf, 4096);
-    end = mime_headers_end(headers);
-    if (end == NULL) {
-       t = headers;
-       if (!strncasecmp(t, "HTTP/", 5)) {
-           reply->version = atof(t + 5);
-           if ((t = strchr(t, ' ')))
-               reply->code = atoi(++t);
-       }
-       memFree(MEM_4K_BUF, headers);
-       return;
-    }
-    reply->hdr_sz = end - headers;
-    line = memAllocate(MEM_4K_BUF);
-    for (s = headers; s < end; s += strcspn(s, crlf), s += strspn(s, crlf)) {
-       l = strcspn(s, crlf) + 1;
-       if (l > 4096)
-           l = 4096;
-       xstrncpy(line, s, l);
-       t = line;
-       debug(11, 3) ("httpParseReplyHeaders: %s\n", t);
-       if (!strncasecmp(t, "HTTP/", 5)) {
-           reply->version = atof(t + 5);
-           if ((t = strchr(t, ' ')))
-               reply->code = atoi(++t);
-       } else if (!strncasecmp(t, "Content-type:", 13)) {
-           for (t += 13; isspace(*t); t++);
-           if ((l = strcspn(t, ";\t ")) > 0)
-               *(t + l) = '\0';
-           xstrncpy(reply->content_type, t, HTTP_REPLY_FIELD_SZ);
-           ReplyHeaderStats.misc[HDR_CONTENT_TYPE]++;
-       } else if (!strncasecmp(t, "Content-length:", 15)) {
-           for (t += 15; isspace(*t); t++);
-           reply->content_length = atoi(t);
-           ReplyHeaderStats.misc[HDR_CONTENT_LENGTH]++;
-       } else if (!strncasecmp(t, "Date:", 5)) {
-           for (t += 5; isspace(*t); t++);
-           reply->date = parse_rfc1123(t);
-           ReplyHeaderStats.misc[HDR_DATE]++;
-       } else if (!strncasecmp(t, "Expires:", 8)) {
-           for (t += 8; isspace(*t); t++);
-           reply->expires = parse_rfc1123(t);
-           /*
-            * The HTTP/1.0 specs says that robust implementations
-            * should consider bad or malformed Expires header as
-            * equivalent to "expires immediately."
-            */
-           if (reply->expires == -1)
-               reply->expires = squid_curtime;
-           ReplyHeaderStats.misc[HDR_EXPIRES]++;
-       } else if (!strncasecmp(t, "Last-Modified:", 14)) {
-           for (t += 14; isspace(*t); t++);
-           reply->last_modified = parse_rfc1123(t);
-           ReplyHeaderStats.misc[HDR_LAST_MODIFIED]++;
-       } else if (!strncasecmp(t, "Accept:", 7)) {
-           ReplyHeaderStats.misc[HDR_ACCEPT]++;
-       } else if (!strncasecmp(t, "Age:", 4)) {
-           ReplyHeaderStats.misc[HDR_AGE]++;
-       } else if (!strncasecmp(t, "Content-MD5:", 12)) {
-           ReplyHeaderStats.misc[HDR_CONTENT_MD5]++;
-       } else if (!strncasecmp(t, "ETag:", 5)) {
-           ReplyHeaderStats.misc[HDR_ETAG]++;
-       } else if (!strncasecmp(t, "Max-Forwards:", 13)) {
-           ReplyHeaderStats.misc[HDR_MAX_FORWARDS]++;
-       } else if (!strncasecmp(t, "Public:", 7)) {
-           ReplyHeaderStats.misc[HDR_PUBLIC]++;
-       } else if (!strncasecmp(t, "Retry-After:", 12)) {
-           ReplyHeaderStats.misc[HDR_RETRY_AFTER]++;
-       } else if (!strncasecmp(t, "Upgrade:", 8)) {
-           ReplyHeaderStats.misc[HDR_UPGRADE]++;
-       } else if (!strncasecmp(t, "Warning:", 8)) {
-           ReplyHeaderStats.misc[HDR_WARNING]++;
-       } else if (!strncasecmp(t, "Cache-Control:", 14)) {
-           for (t += 14; isspace(*t); t++);
-           if (!strncasecmp(t, "public", 6)) {
-               EBIT_SET(reply->cache_control, SCC_PUBLIC);
-               ReplyHeaderStats.cc[SCC_PUBLIC]++;
-           } else if (!strncasecmp(t, "private", 7)) {
-               EBIT_SET(reply->cache_control, SCC_PRIVATE);
-               ReplyHeaderStats.cc[SCC_PRIVATE]++;
-           } else if (!strncasecmp(t, "no-cache", 8)) {
-               EBIT_SET(reply->cache_control, SCC_NOCACHE);
-               ReplyHeaderStats.cc[SCC_NOCACHE]++;
-           } else if (!strncasecmp(t, "no-store", 8)) {
-               EBIT_SET(reply->cache_control, SCC_NOSTORE);
-               ReplyHeaderStats.cc[SCC_NOSTORE]++;
-           } else if (!strncasecmp(t, "no-transform", 12)) {
-               EBIT_SET(reply->cache_control, SCC_NOTRANSFORM);
-               ReplyHeaderStats.cc[SCC_NOTRANSFORM]++;
-           } else if (!strncasecmp(t, "must-revalidate", 15)) {
-               EBIT_SET(reply->cache_control, SCC_MUSTREVALIDATE);
-               ReplyHeaderStats.cc[SCC_MUSTREVALIDATE]++;
-           } else if (!strncasecmp(t, "proxy-revalidate", 16)) {
-               EBIT_SET(reply->cache_control, SCC_PROXYREVALIDATE);
-               ReplyHeaderStats.cc[SCC_PROXYREVALIDATE]++;
-           } else if (!strncasecmp(t, "max-age", 7)) {
-               if ((t = strchr(t, '='))) {
-                   delta = (time_t) atoi(++t);
-                   reply->expires = squid_curtime + delta;
-                   EBIT_SET(reply->cache_control, SCC_MAXAGE);
-                   ReplyHeaderStats.cc[SCC_MAXAGE]++;
-               }
-           }
-       } else if (!strncasecmp(t, "Set-Cookie:", 11)) {
-           EBIT_SET(reply->misc_headers, HDR_SET_COOKIE);
-           ReplyHeaderStats.misc[HDR_SET_COOKIE]++;
-       } else if (!strncasecmp(t, "Proxy-Connection:", 17)) {
-           for (t += 17; isspace(*t); t++);
-           if (!strcasecmp(t, "Keep-Alive"))
-               EBIT_SET(reply->misc_headers, HDR_PROXY_KEEPALIVE);
-       }
-    }
-    memFree(MEM_4K_BUF, headers);
-    memFree(MEM_4K_BUF, line);
-}
-#endif /* 0 */
-
 static int
 httpCachableReply(HttpStateData * httpState)
 {
@@ -1150,31 +932,6 @@ httpConnectDone(int fd, int status, void *data)
     }
 }
 
-#if 0                          /* moved to httpHeader */
-void
-httpReplyHeaderStats(StoreEntry * entry)
-{
-    http_server_cc_t i;
-    http_hdr_misc_t j;
-    storeAppendPrintf(entry, "HTTP Reply Headers:\n");
-    storeAppendPrintf(entry, "       Headers parsed: %d\n",
-       ReplyHeaderStats.parsed);
-    for (j = HDR_AGE; j < HDR_MISC_END; j++)
-       storeAppendPrintf(entry, "%21.21s: %d\n",
-           HttpHdrMiscStr[j],
-           ReplyHeaderStats.misc[j]);
-    for (i = CC_PUBLIC; i < CC_ENUM_END; i++)
-       storeAppendPrintf(entry, "Cache-Control %s: %d\n",
-           HttpServerCCStr[i],
-           ReplyHeaderStats.cc[i]);
-}
-#endif
-
-void
-httpInit(void)
-{
-}
-
 static void
 httpAbort(void *data)
 {
@@ -1183,162 +940,6 @@ httpAbort(void *data)
     comm_close(httpState->fd);
 }
 
-#if 0                          /* moved to httpResponse.c */
-static char *
-httpStatusString(int status)
-{
-    char *p = NULL;
-    switch (status) {
-    case 100:
-       p = "Continue";
-       break;
-    case 101:
-       p = "Switching Protocols";
-       break;
-    case 200:
-       p = "OK";
-       break;
-    case 201:
-       p = "Created";
-       break;
-    case 202:
-       p = "Accepted";
-       break;
-    case 203:
-       p = "Non-Authoritative Information";
-       break;
-    case 204:
-       p = "No Content";
-       break;
-    case 205:
-       p = "Reset Content";
-       break;
-    case 206:
-       p = "Partial Content";
-       break;
-    case 300:
-       p = "Multiple Choices";
-       break;
-    case 301:
-       p = "Moved Permanently";
-       break;
-    case 302:
-       p = "Moved Temporarily";
-       break;
-    case 303:
-       p = "See Other";
-       break;
-    case 304:
-       p = "Not Modified";
-       break;
-    case 305:
-       p = "Use Proxy";
-       break;
-    case 400:
-       p = "Bad Request";
-       break;
-    case 401:
-       p = "Unauthorized";
-       break;
-    case 402:
-       p = "Payment Required";
-       break;
-    case 403:
-       p = "Forbidden";
-       break;
-    case 404:
-       p = "Not Found";
-       break;
-    case 405:
-       p = "Method Not Allowed";
-       break;
-    case 406:
-       p = "Not Acceptable";
-       break;
-    case 407:
-       p = "Proxy Authentication Required";
-       break;
-    case 408:
-       p = "Request Time-out";
-       break;
-    case 409:
-       p = "Conflict";
-       break;
-    case 410:
-       p = "Gone";
-       break;
-    case 411:
-       p = "Length Required";
-       break;
-    case 412:
-       p = "Precondition Failed";
-       break;
-    case 413:
-       p = "Request Entity Too Large";
-       break;
-    case 414:
-       p = "Request-URI Too Large";
-       break;
-    case 415:
-       p = "Unsupported Media Type";
-       break;
-    case 500:
-       p = "Internal Server Error";
-       break;
-    case 501:
-       p = "Not Implemented";
-       break;
-    case 502:
-       p = "Bad Gateway";
-       break;
-    case 503:
-       p = "Service Unavailable";
-       break;
-    case 504:
-       p = "Gateway Time-out";
-       break;
-    case 505:
-       p = "HTTP Version not supported";
-       break;
-    default:
-       p = "Unknown";
-       debug(11, 0) ("Unknown HTTP status code: %d\n", status);
-       break;
-    }
-    return p;
-}
-#endif
-
-#if 0                          /* moved to HttpResponse.c */
-char *
-httpReplyHeader(double ver,
-    http_status status,
-    char *ctype,
-    int clen,
-    time_t lmt,
-    time_t expires)
-{
-    LOCAL_ARRAY(char, buf, HTTP_REPLY_BUF_SZ);
-    int l = 0;
-    int s = HTTP_REPLY_BUF_SZ;
-    l += snprintf(buf + l, s - l, "HTTP/%3.1f %d %s\r\n",
-       ver,
-       (int) status,
-       httpStatusString(status));
-    l += snprintf(buf + l, s - l, "Server: Squid/%s\r\n", SQUID_VERSION);
-    l += snprintf(buf + l, s - l, "Date: %s\r\n", mkrfc1123(squid_curtime));
-    if (expires >= 0)
-       l += snprintf(buf + l, s - l, "Expires: %s\r\n", mkrfc1123(expires));
-    if (lmt)
-       l += snprintf(buf + l, s - l, "Last-Modified: %s\r\n", mkrfc1123(lmt));
-    if (clen > 0)
-       l += snprintf(buf + l, s - l, "Content-Length: %d\r\n", clen);
-    if (ctype)
-       l += snprintf(buf + l, s - l, "Content-Type: %s\r\n", ctype);
-    return buf;
-}
-#endif
-
 static void
 httpSendRequestEntry(int fd, char *bufnotused, size_t size, int errflag, void  *data)
 {
index 6ac7535830d1d8144375fe35cf170ef8aede8cda..ca55116c58b41fcd46b7be02011b36fa436cfdbe 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.233 1998/03/06 22:19:38 wessels Exp $
+ * $Id: main.cc,v 1.234 1998/03/06 23:22:29 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -461,7 +461,6 @@ mainInitialize(void)
        cachemgrInit();
        statInit();
        storeInit();
-       httpInit();
        asnAclInitialize(Config.aclList);
        if (Config.effectiveUser) {
            /* we were probably started as root, so cd to a swap
@@ -624,11 +623,6 @@ main(int argc, char **argv)
 #endif
            if (shutdown_pending) {
                normal_shutdown();
-#if 0
-           } else if (reconfigure_pending) {
-               mainReconfigure();
-               reconfigure_pending = 0;        /* reset */
-#endif
            } else {
                fatal_dump("MAIN: SHUTDOWN from comm_select, but nothing pending.");
            }
index aca5309a1a40ebf398fdae6294cdf1d55354d0dd..092ed42a24d7b9f8ea910e76484d19a24050984e 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.53 1998/03/03 00:31:10 rousskov Exp $
+ * $Id: mime.cc,v 1.54 1998/03/06 23:22:30 wessels Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -418,9 +418,6 @@ mimeLoadIconFile(const char *icon)
 {
     int fd;
     int n;
-#if 0
-    int l;
-#endif
     int flags;
     struct stat sb;
     StoreEntry *e;
@@ -453,27 +450,12 @@ mimeLoadIconFile(const char *icon)
        METHOD_GET);
     assert(e != NULL);
     e->mem_obj->request = requestLink(urlParse(METHOD_GET, url));
-#if 0                          /* use new interface */
-    buf = memAllocate(MEM_4K_BUF);
-    l = 0;
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "HTTP/1.0 200 OK\r\n");
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Date: %s\r\n", mkrfc1123(squid_curtime));
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Server: Squid/%s\r\n", version_string);
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Type: %s\r\n", type);
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Content-Length: %d\r\n", (int) sb.st_size);
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Last-Modified: %s\r\n", mkrfc1123(sb.st_mtime));
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "Expires: %s\r\n", mkrfc1123(squid_curtime + 86400));
-    l += snprintf(buf + l, SM_PAGE_SIZE - l, "\r\n");
-    httpParseReplyHeaders(buf, e->mem_obj->reply);
-    storeAppend(e, buf, l);
-#else
     httpReplyReset(e->mem_obj->reply);
     httpReplySetHeaders(e->mem_obj->reply, 1.0, 200, NULL,
        type, (int) sb.st_size, sb.st_mtime, squid_curtime + 86400);
     httpReplySwapOut(e->mem_obj->reply, e);
     /* read the file into the buffer and append it to store */
     buf = memAllocate(MEM_4K_BUF);
-#endif
     while ((n = read(fd, buf, 4096)) > 0)
        storeAppend(e, buf, n);
     file_close(fd);
index 299a25c13ba3b5969fed3fe606fee7667cf95d96..d5bc44ee524ab70d2508f4e254e1e746aa039664 100644 (file)
@@ -539,9 +539,6 @@ extern void memClean();
 extern void memInitModule();
 extern void memCleanModule();
 extern void memConfigure();
-#if 0                          /* not used */
-extern void memFreeMemory(void);
-#endif
 extern void *memAllocate(mem_type);
 extern void memFree(mem_type, void *);
 extern void memFree4K(void *);
index c7a80f9bce9611baa997848959347498dfbbfa14..6b17a96099b1d9282f51395bfa525038ce2ae424 100644 (file)
@@ -274,9 +274,6 @@ community_check(char *b, oid * name, int namelen)
     print_oid(name, namelen);
     for (cp = Config.Snmp.communities; cp; cp = cp->next)
        if (!strcmp(b, cp->name)) {
-#if 0
-           debug(49, 6) ("community_check: found %s, comparing with\n", cp->name);
-#endif
            return in_view(name, namelen, cp->readView);
        }
     return 0;
index 4c8673af3a9a1b866918f01222f5ffe9c2c82575..3bf6c43f0028b701ea9197d48f1fbb4b825bd7b7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.391 1998/03/06 22:19:42 wessels Exp $
+ * $Id: store.cc,v 1.392 1998/03/06 23:22:35 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -970,14 +970,6 @@ storeTimestampsSet(StoreEntry * entry)
 {
     time_t served_date = -1;
     HttpReply *reply = entry->mem_obj->reply;
-#if 0                          /* new interface */
-    served_date = reply->date > -1 ? reply->date : squid_curtime;
-    entry->expires = reply->expires;
-    if (reply->last_modified > -1)
-       entry->lastmod = reply->last_modified;
-    else
-       entry->lastmod = served_date;
-#else
     served_date = httpHeaderGetTime(&reply->hdr, HDR_DATE);
     if (served_date < 0)
        served_date = squid_curtime;
@@ -985,7 +977,6 @@ storeTimestampsSet(StoreEntry * entry)
     entry->lastmod = httpHeaderGetTime(&reply->hdr, HDR_LAST_MODIFIED);
     if (entry->lastmod < 0)
        entry->lastmod = served_date;
-#endif
     entry->timestamp = served_date;
 
 }
@@ -1094,23 +1085,6 @@ storeCreateMemObject(StoreEntry * e, const char *url, const char *log_url)
     e->mem_obj = new_MemObject(url, log_url);
 }
 
-#if 0                          /* moved to HttpReply.c (has nothing to do with store.c) */
-void
-storeCopyNotModifiedReplyHeaders(MemObject * oldmem, MemObject * newmem)
-{
-    http_reply *oldreply = oldmem->reply;
-    http_reply *newreply = newmem->reply;
-    oldreply->cache_control = newreply->cache_control;
-    oldreply->misc_headers = newreply->misc_headers;
-    if (newreply->date > -1)
-       oldreply->date = newreply->date;
-    if (newreply->last_modified > -1)
-       oldreply->last_modified = newreply->last_modified;
-    if (newreply->expires > -1)
-       oldreply->expires = newreply->expires;
-}
-#endif
-
 /* this just sets DELAY_SENDING */
 void
 storeBuffer(StoreEntry * e)
index 1b7c8f4ffe1242ff379676faf6e8b5cecd049396..be064fac8b8ea2b59bdbe8b3e5bb30dbdb21b66e 100644 (file)
@@ -847,15 +847,6 @@ struct _icp_common_t {
     u_num32 shostid;           /* sender host id */
 };
 
-#if 0                          /* this struct is not used */
-struct _Stack {
-    void **base;
-    void **top;
-    int stack_size;
-};
-
-#endif
-
 struct _iostats {
     struct {
        int reads;
index a22c762d0aefd9a226aaa72eb408f606f27ed7cd..d18878010c8161fa99a0263dc6cfdf5bff242fb8 100644 (file)
@@ -152,11 +152,7 @@ urnHandleReply(void *data, char *buf, ssize_t size)
     StoreEntry *e = urnState->entry;
     StoreEntry *urlres_e = urnState->urlres_e;
     char *s = NULL;
-#if 0
-    char *hdr;
-#else
     HttpReply *rep;
-#endif
     wordlist *w;
     wordlist *urls;
     wordlist *min_w;
@@ -245,24 +241,6 @@ urnHandleReply(void *data, char *buf, ssize_t size)
        "</ADDRESS>\n",
        appname, version_string, getMyHostname());
     stringAppend(S, line, l);
-#if 0                          /* use new interface */
-    hdr = httpReplyHeader(1.0,
-       HTTP_MOVED_TEMPORARILY,
-       "text/html",
-       stringLength(S),
-       0,
-       squid_curtime);
-    storeAppend(e, hdr, strlen(hdr));
-    httpParseReplyHeaders(hdr, e->mem_obj->reply);
-    if (EBIT_TEST(urnState->flags, URN_FORCE_MENU)) {
-       debug(52, 3) ("urnHandleReply: forcing menu\n");
-    } else if (min_w) {
-       l = snprintf(line, 4096, "Location: %s\r\n", min_w->key);
-       storeAppend(e, line, l);
-    }
-    storeAppend(e, "\r\n", 2);
-    storeAppend(e, S->buf, stringLength(S));
-#else
     rep = e->mem_obj->reply;
     httpReplyReset(rep);
     httpReplySetHeaders(rep, 1.0, HTTP_MOVED_TEMPORARILY, NULL,
@@ -274,7 +252,6 @@ urnHandleReply(void *data, char *buf, ssize_t size)
     }
     httpBodySet(&rep->body, S->buf, stringLength(S) + 1, NULL);
     httpReplySwapOut(rep, e);
-#endif
     storeComplete(e);
     memFree(MEM_4K_BUF, buf);
     wordlistDestroy(&urls);