--------------------- PatchSet 11258 Date: 2007/02/25 11:09:17 Author: hno Branch: HEAD Tag: (none) Log: Kill the psuedo-support for wais. Was never really implemented. This change removes the wais_relay_host/port directives. WAIS support was never really implemented but relied on forwarding the requests to some other proxy/gateway using HTTP. Now this can just as well be done with cache_peer so there is no point in having this duplicated and unmaintained forwarding code around. Members: src/Makefile.am:1.56->1.57 src/Makefile.in:1.281->1.282 src/cache_cf.c:1.464->1.465 src/cf.data.pre:1.384->1.385 src/client_side.c:1.704->1.705 src/forward.c:1.122->1.123 src/peer_select.c:1.132->1.133 src/protos.h:1.524->1.525 src/stat.c:1.378->1.379 src/structs.h:1.509->1.510 src/wais.c:1.143->1.144(DEAD) Index: squid/src/Makefile.am =================================================================== RCS file: /cvsroot/squid/squid/src/Makefile.am,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- squid/src/Makefile.am 30 Oct 2006 00:07:33 -0000 1.56 +++ squid/src/Makefile.am 25 Feb 2007 11:09:17 -0000 1.57 @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.56 2006/10/30 00:07:33 hno Exp $ +# $Id: Makefile.am,v 1.57 2007/02/25 11:09:17 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -237,7 +237,6 @@ url.c \ urn.c \ useragent.c \ - wais.c \ wccp.c \ wccp2.c \ whois.c \ Index: squid/src/Makefile.in =================================================================== RCS file: /cvsroot/squid/squid/src/Makefile.in,v retrieving revision 1.281 retrieving revision 1.282 diff -u -r1.281 -r1.282 --- squid/src/Makefile.in 4 Nov 2006 23:20:03 -0000 1.281 +++ squid/src/Makefile.in 25 Feb 2007 11:09:17 -0000 1.282 @@ -17,7 +17,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.281 2006/11/04 23:20:03 hno Exp $ +# $Id: Makefile.in,v 1.282 2007/02/25 11:09:17 hno Exp $ # # Uncomment and customize the following to suit your needs: # @@ -102,7 +102,7 @@ store_digest.c store_dir.c store_key_md5.c store_log.c \ store_rebuild.c store_swapin.c store_swapmeta.c \ store_swapout.c structs.h tools.c typedefs.h unlinkd.c url.c \ - urn.c useragent.c wais.c wccp.c wccp2.c whois.c win32.c + urn.c useragent.c wccp.c wccp2.c whois.c win32.c @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_FALSE@@USE_SELECT_SIMPLE_FALSE@@USE_SELECT_WIN32_TRUE@am__objects_1 = comm_select_win32.$(OBJEXT) @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_SIMPLE_FALSE@@USE_SELECT_TRUE@am__objects_1 = comm_select.$(OBJEXT) @USE_EPOLL_FALSE@@USE_KQUEUE_FALSE@@USE_POLL_FALSE@@USE_SELECT_SIMPLE_TRUE@am__objects_1 = comm_select_simple.$(OBJEXT) @@ -155,8 +155,8 @@ store_rebuild.$(OBJEXT) store_swapin.$(OBJEXT) \ store_swapmeta.$(OBJEXT) store_swapout.$(OBJEXT) \ tools.$(OBJEXT) $(am__objects_9) url.$(OBJEXT) urn.$(OBJEXT) \ - useragent.$(OBJEXT) wais.$(OBJEXT) wccp.$(OBJEXT) \ - wccp2.$(OBJEXT) whois.$(OBJEXT) $(am__objects_10) + useragent.$(OBJEXT) wccp.$(OBJEXT) wccp2.$(OBJEXT) \ + whois.$(OBJEXT) $(am__objects_10) nodist_squid_OBJECTS = repl_modules.$(OBJEXT) auth_modules.$(OBJEXT) \ store_modules.$(OBJEXT) globals.$(OBJEXT) \ string_arrays.$(OBJEXT) @@ -535,7 +535,6 @@ url.c \ urn.c \ useragent.c \ - wais.c \ wccp.c \ wccp2.c \ whois.c \ @@ -844,7 +843,6 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/url.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urn.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/useragent.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wais.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wccp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wccp2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/whois.Po@am__quote@ Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid/squid/src/cache_cf.c,v retrieving revision 1.464 retrieving revision 1.465 diff -u -r1.464 -r1.465 --- squid/src/cache_cf.c 5 Feb 2007 15:17:12 -0000 1.464 +++ squid/src/cache_cf.c 25 Feb 2007 11:09:18 -0000 1.465 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.464 2007/02/05 15:17:12 hno Exp $ + * $Id: cache_cf.c,v 1.465 2007/02/25 11:09:18 hno Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -497,13 +497,6 @@ if (!Config.onoff.via) debug(22, 1) ("WARNING: HTTP requires the use of Via\n"); #endif - if (Config.Wais.relayHost) { - if (Config.Wais.peer) - cbdataFree(Config.Wais.peer); - Config.Wais.peer = cbdataAlloc(peer); - Config.Wais.peer->host = xstrdup(Config.Wais.relayHost); - Config.Wais.peer->http_port = Config.Wais.relayPort; - } if (aclPurgeMethodInUse(Config.accessList.http)) Config2.onoff.enable_purge = 1; if (geteuid() == 0) { Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid/squid/src/cf.data.pre,v retrieving revision 1.384 retrieving revision 1.385 diff -u -r1.384 -r1.385 --- squid/src/cf.data.pre 28 Jan 2007 23:53:42 -0000 1.384 +++ squid/src/cf.data.pre 25 Feb 2007 11:09:18 -0000 1.385 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.384 2007/01/28 23:53:42 hno Exp $ +# $Id: cf.data.pre,v 1.385 2007/02/25 11:09:18 hno Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -2231,21 +2231,6 @@ ----------------------------------------------------------------------------- COMMENT_END -NAME: wais_relay_host -TYPE: string -DEFAULT: none -LOC: Config.Wais.relayHost -DOC_NONE - -NAME: wais_relay_port -TYPE: ushort -DEFAULT: 0 -LOC: Config.Wais.relayPort -DOC_START - Relay WAIS request to host (1st arg) at port (2 arg). -DOC_END - - NAME: request_header_max_size COMMENT: (KB) TYPE: b_size_t Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid/squid/src/client_side.c,v retrieving revision 1.704 retrieving revision 1.705 diff -u -r1.704 -r1.705 --- squid/src/client_side.c 9 Feb 2007 13:24:18 -0000 1.704 +++ squid/src/client_side.c 25 Feb 2007 11:09:19 -0000 1.705 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.704 2007/02/09 13:24:18 hno Exp $ + * $Id: client_side.c,v 1.705 2007/02/25 11:09:19 hno Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1607,8 +1607,6 @@ if (req->protocol == PROTO_HTTP) return httpCachable(method); /* FTP is always cachable */ - if (req->protocol == PROTO_WAIS) - return 0; if (method == METHOD_CONNECT) return 0; if (method == METHOD_TRACE) @@ -1653,8 +1651,6 @@ return httpCachable(method); if (request->protocol == PROTO_GOPHER) return gopherCachable(request); - if (request->protocol == PROTO_WAIS) - return 0; if (request->protocol == PROTO_CACHEOBJ) return 0; return 1; Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid/squid/src/forward.c,v retrieving revision 1.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- squid/src/forward.c 2 Feb 2007 12:22:16 -0000 1.122 +++ squid/src/forward.c 25 Feb 2007 11:09:19 -0000 1.123 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.122 2007/02/02 12:22:16 hno Exp $ + * $Id: forward.c,v 1.123 2007/02/25 11:09:19 hno Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -692,9 +692,6 @@ case PROTO_FTP: ftpStart(fwdState); break; - case PROTO_WAIS: - waisStart(fwdState); - break; case PROTO_CACHEOBJ: case PROTO_INTERNAL: case PROTO_URN: @@ -703,6 +700,7 @@ case PROTO_WHOIS: whoisStart(fwdState); break; + case PROTO_WAIS: /* not implemented */ default: debug(17, 1) ("fwdDispatch: Cannot retrieve '%s'\n", storeUrl(entry)); Index: squid/src/peer_select.c =================================================================== RCS file: /cvsroot/squid/squid/src/peer_select.c,v retrieving revision 1.132 retrieving revision 1.133 diff -u -r1.132 -r1.133 --- squid/src/peer_select.c 21 Jan 2007 12:54:00 -0000 1.132 +++ squid/src/peer_select.c 25 Feb 2007 11:09:19 -0000 1.133 @@ -1,6 +1,6 @@ /* - * $Id: peer_select.c,v 1.132 2007/01/21 12:54:00 adrian Exp $ + * $Id: peer_select.c,v 1.133 2007/02/25 11:09:19 hno Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -451,10 +451,8 @@ if (ps->direct == DIRECT_NO) return; if (ps->request->protocol == PROTO_WAIS) - /* Its not really DIRECT, now is it? */ - peerAddFwdServer(&ps->servers, Config.Wais.peer, HIER_DIRECT); - else - peerAddFwdServer(&ps->servers, NULL, HIER_DIRECT); + return; /* No server-side implemented, can't go direct */ + peerAddFwdServer(&ps->servers, NULL, HIER_DIRECT); } static void Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid/squid/src/protos.h,v retrieving revision 1.524 retrieving revision 1.525 diff -u -r1.524 -r1.525 --- squid/src/protos.h 26 Jan 2007 02:33:12 -0000 1.524 +++ squid/src/protos.h 25 Feb 2007 11:09:19 -0000 1.525 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.524 2007/01/26 02:33:12 adrian Exp $ + * $Id: protos.h,v 1.525 2007/02/25 11:09:19 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -806,7 +806,6 @@ extern void start_announce(void *unused); extern void sslStart(clientHttpRequest *, squid_off_t *, int *); -extern void waisStart(FwdState *); /* ident.c */ #if USE_IDENT Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid/squid/src/stat.c,v retrieving revision 1.378 retrieving revision 1.379 diff -u -r1.378 -r1.379 --- squid/src/stat.c 21 Jan 2007 12:54:00 -0000 1.378 +++ squid/src/stat.c 25 Feb 2007 11:09:19 -0000 1.379 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.378 2007/01/21 12:54:00 adrian Exp $ + * $Id: stat.c,v 1.379 2007/02/25 11:09:19 hno Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -175,16 +175,6 @@ } storeAppendPrintf(sentry, "\n"); - storeAppendPrintf(sentry, "WAIS I/O\n"); - storeAppendPrintf(sentry, "number of reads: %d\n", IOStats.Wais.reads); - storeAppendPrintf(sentry, "Read Histogram:\n"); - for (i = 0; i < 16; i++) { - storeAppendPrintf(sentry, "%5d-%5d: %9d %2d%%\n", - i ? (1 << (i - 1)) + 1 : 1, - 1 << i, - IOStats.Wais.read_hist[i], - percent(IOStats.Wais.read_hist[i], IOStats.Wais.reads)); - } } static const char * Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid/squid/src/structs.h,v retrieving revision 1.509 retrieving revision 1.510 diff -u -r1.509 -r1.510 --- squid/src/structs.h 28 Jan 2007 23:53:42 -0000 1.509 +++ squid/src/structs.h 25 Feb 2007 11:09:19 -0000 1.510 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.509 2007/01/28 23:53:42 hno Exp $ + * $Id: structs.h,v 1.510 2007/02/25 11:09:19 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -431,11 +431,6 @@ } Swap; squid_off_t memMaxSize; struct { - char *relayHost; - u_short relayPort; - peer *peer; - } Wais; - struct { squid_off_t min; int pct; squid_off_t max; @@ -1611,7 +1606,7 @@ int read_hist[16]; int writes; int write_hist[16]; - } Http, Ftp, Gopher, Wais; + } Http, Ftp, Gopher; }; struct _mem_node { --- squid/src/wais.c Sun Feb 25 11:55:02 2007 +++ /dev/null Sun Feb 25 11:55:02 2007 @@ -1,235 +0,0 @@ - -/* - * $Id: wais.c,v 1.143 2007/01/21 12:54:00 adrian Exp $ - * - * DEBUG: section 24 WAIS Relay - * AUTHOR: Harvest Derived - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" - -typedef struct { - int fd; - StoreEntry *entry; - method_t method; - const HttpHeader *request_hdr; - char url[MAX_URL]; - request_t *request; - FwdState *fwd; -} WaisStateData; - -static PF waisStateFree; -static PF waisTimeout; -static PF waisReadReply; -static CWCB waisSendComplete; -static PF waisSendRequest; - -static void -waisStateFree(int fdnotused, void *data) -{ - WaisStateData *waisState = data; - if (waisState == NULL) - return; - storeUnlockObject(waisState->entry); - requestUnlink(waisState->request); - cbdataFree(waisState); -} - -/* This will be called when socket lifetime is expired. */ -static void -waisTimeout(int fd, void *data) -{ - WaisStateData *waisState = data; - StoreEntry *entry = waisState->entry; - debug(24, 4) ("waisTimeout: FD %d: '%s'\n", fd, storeUrl(entry)); - if (entry->store_status == STORE_PENDING) { - fwdFail(waisState->fwd, - errorCon(ERR_READ_TIMEOUT, HTTP_GATEWAY_TIMEOUT, waisState->fwd->request)); - } - comm_close(fd); -} - -/* This will be called when data is ready to be read from fd. Read until - * error or connection closed. */ -static void -waisReadReply(int fd, void *data) -{ - WaisStateData *waisState = data; - LOCAL_ARRAY(char, buf, 4096); - StoreEntry *entry = waisState->entry; - int len; - int clen; - int bin; - size_t read_sz; -#if DELAY_POOLS - delay_id delay_id; -#endif - if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - comm_close(fd); - return; - } - errno = 0; - read_sz = 4096; -#if DELAY_POOLS - delay_id = delayMostBytesAllowed(entry->mem_obj, &read_sz); -#endif - statCounter.syscalls.sock.reads++; - len = FD_READ_METHOD(fd, buf, read_sz); - if (len > 0) { - fd_bytes(fd, len, FD_READ); -#if DELAY_POOLS - delayBytesIn(delay_id, len); -#endif - kb_incr(&statCounter.server.all.kbytes_in, len); - kb_incr(&statCounter.server.other.kbytes_in, len); - } - debug(24, 5) ("waisReadReply: FD %d read len:%d\n", fd, len); - if (len > 0) { - commSetTimeout(fd, Config.Timeout.read, NULL, NULL); - IOStats.Wais.reads++; - for (clen = len - 1, bin = 0; clen; bin++) - clen >>= 1; - IOStats.Wais.read_hist[bin]++; - } - if (len < 0) { - debug(50, 1) ("waisReadReply: FD %d: read failure: %s.\n", - fd, xstrerror()); - if (ignoreErrno(errno)) { - /* reinstall handlers */ - /* XXX This may loop forever */ - commSetSelect(fd, COMM_SELECT_READ, - waisReadReply, waisState, 0); - } else { - ErrorState *err; - err = errorCon(ERR_READ_ERROR, HTTP_INTERNAL_SERVER_ERROR, waisState->fwd->request); - err->xerrno = errno; - fwdFail(waisState->fwd, err); - comm_close(fd); - } - } else if (len == 0 && entry->mem_obj->inmem_hi == 0) { - fwdFail(waisState->fwd, errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE, waisState->fwd->request)); - comm_close(fd); - } else if (len == 0) { - /* Connection closed; retrieval done. */ - entry->expires = squid_curtime; - fwdComplete(waisState->fwd); - comm_close(fd); - } else { - storeAppend(entry, buf, len); - commSetSelect(fd, - COMM_SELECT_READ, - waisReadReply, - waisState, 0); - } -} - -/* This will be called when request write is complete. Schedule read of - * reply. */ -static void -waisSendComplete(int fd, char *bufnotused, size_t size, int errflag, void *data) -{ - WaisStateData *waisState = data; - StoreEntry *entry = waisState->entry; - debug(24, 5) ("waisSendComplete: FD %d size: %d errflag: %d\n", - fd, (int) size, errflag); - if (size > 0) { - fd_bytes(fd, size, FD_WRITE); - kb_incr(&statCounter.server.all.kbytes_out, size); - kb_incr(&statCounter.server.other.kbytes_out, size); - } - if (errflag == COMM_ERR_CLOSING) - return; - if (errflag) { - ErrorState *err; - err = errorCon(ERR_WRITE_ERROR, HTTP_SERVICE_UNAVAILABLE, waisState->fwd->request); - err->xerrno = errno; - fwdFail(waisState->fwd, err); - comm_close(fd); - } else { - /* Schedule read reply. */ - commSetSelect(fd, - COMM_SELECT_READ, - waisReadReply, - waisState, 0); - commSetDefer(fd, fwdCheckDeferRead, entry); - } -} - -/* This will be called when connect completes. Write request. */ -static void -waisSendRequest(int fd, void *data) -{ - WaisStateData *waisState = data; - MemBuf mb; - const char *Method = RequestMethods[waisState->method].str; - debug(24, 5) ("waisSendRequest: FD %d\n", fd); - memBufDefInit(&mb); - memBufPrintf(&mb, "%s %s HTTP/1.0\r\n", Method, waisState->url); - if (waisState->request_hdr) { - Packer p; - packerToMemInit(&p, &mb); - httpHeaderPackInto(waisState->request_hdr, &p); - packerClean(&p); - } - memBufPrintf(&mb, "\r\n"); - debug(24, 6) ("waisSendRequest: buf: %s\n", mb.buf); - comm_write_mbuf(fd, mb, waisSendComplete, waisState); - if (EBIT_TEST(waisState->entry->flags, ENTRY_CACHABLE)) - storeSetPublicKey(waisState->entry); /* Make it public */ - EBIT_CLR(waisState->entry->flags, ENTRY_FWD_HDR_WAIT); -} - -CBDATA_TYPE(WaisStateData); -void -waisStart(FwdState * fwd) -{ - WaisStateData *waisState = NULL; - request_t *request = fwd->request; - StoreEntry *entry = fwd->entry; - int fd = fwd->server_fd; - const char *url = storeUrl(entry); - method_t method = request->method; - debug(24, 3) ("waisStart: \"%s %s\"\n", RequestMethods[method].str, url); - statCounter.server.all.requests++; - statCounter.server.other.requests++; - CBDATA_INIT_TYPE(WaisStateData); - waisState = cbdataAlloc(WaisStateData); - waisState->method = method; - waisState->request_hdr = &request->header; - waisState->fd = fd; - waisState->entry = entry; - xstrncpy(waisState->url, url, MAX_URL); - waisState->request = requestLink(request); - waisState->fwd = fwd; - comm_add_close_handler(waisState->fd, waisStateFree, waisState); - storeLockObject(entry); - commSetSelect(fd, COMM_SELECT_WRITE, waisSendRequest, waisState, 0); - commSetTimeout(fd, Config.Timeout.read, waisTimeout, waisState); -}