From: wessels <> Date: Sat, 7 Mar 1998 06:22:23 +0000 (+0000) Subject: removed lots of #if 0 code X-Git-Tag: SQUID_3_0_PRE1~3895 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=269704991d7aeb0e49aba62508ab61ead1180156;p=thirdparty%2Fsquid.git removed lots of #if 0 code --- diff --git a/src/asn.cc b/src/asn.cc index 0e70aec1eb..91bd5b2e80 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -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++) { diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 4b175ce1b0..25574ddd4f 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -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 : "", 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); diff --git a/src/debug.cc b/src/debug.cc index 14d7b44e05..aa91e8ba13 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -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. diff --git a/src/defines.h b/src/defines.h index 5cfbddcca3..5894a17a9b 100644 --- a/src/defines.h +++ b/src/defines.h @@ -67,21 +67,20 @@ /* * 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 */ diff --git a/src/enums.h b/src/enums.h index a945233889..f504afb26d 100644 --- a/src/enums.h +++ b/src/enums.h @@ -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, diff --git a/src/ftp.cc b/src/ftp.cc index dcf66a95fb..f8d3301c29 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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); diff --git a/src/http.cc b/src/http.cc index bfdad1baa7..0fc16efae5 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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 @@ -113,21 +113,6 @@ 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) { diff --git a/src/main.cc b/src/main.cc index 6ac7535830..ca55116c58 100644 --- a/src/main.cc +++ b/src/main.cc @@ -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."); } diff --git a/src/mime.cc b/src/mime.cc index aca5309a1a..092ed42a24 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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); diff --git a/src/protos.h b/src/protos.h index 299a25c13b..d5bc44ee52 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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 *); diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index c7a80f9bce..6b17a96099 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -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; diff --git a/src/store.cc b/src/store.cc index 4c8673af3a..3bf6c43f00 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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) diff --git a/src/structs.h b/src/structs.h index 1b7c8f4ffe..be064fac8b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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; diff --git a/src/urn.cc b/src/urn.cc index a22c762d0a..d18878010c 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -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) "\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);