--------------------- PatchSet 4038 Date: 2002/04/18 07:36:50 Author: geetham Branch: icap Tag: (none) Log: Modifications to make squid an ICAP client. (on --enable-icap-support) Ref: draft-elson-opes-icap-01.txt Feb 2000 Members: acconfig.h:1.18->1.18.2.1 configure.in:1.52->1.52.2.1 src/Makefile.am:1.19->1.19.2.1 src/cbdata.c:1.15->1.15.2.1 src/cf.data.pre:1.59->1.59.2.1 src/client_side.c:1.58->1.58.2.1 src/enums.h:1.32->1.32.6.1 src/forward.c:1.15->1.15.2.1 src/http.c:1.20->1.20.10.1 src/main.c:1.32->1.32.4.1 src/store_client.c:1.12->1.12.2.1 src/structs.h:1.55->1.55.2.1 src/typedefs.h:1.26->1.26.4.1 Index: squid/acconfig.h =================================================================== RCS file: /cvsroot/squid-sf//squid/Attic/acconfig.h,v retrieving revision 1.18 retrieving revision 1.18.2.1 diff -u -r1.18 -r1.18.2.1 --- squid/acconfig.h 13 Apr 2002 23:09:52 -0000 1.18 +++ squid/acconfig.h 18 Apr 2002 07:36:50 -0000 1.18.2.1 @@ -23,7 +23,7 @@ #ifndef __CONFIGURE_H__ #define __CONFIGURE_H__ @TOP@ -/* $Id: acconfig.h,v 1.18 2002/04/13 23:09:52 squidadm Exp $ */ +/* $Id: acconfig.h,v 1.18.2.1 2002/04/18 07:36:50 geetham Exp $ */ /* * configure command line used to configure Squid @@ -93,6 +93,20 @@ */ #undef DELAY_POOLS + +/* + * ICAP - Internet Content Adaptation Protocol + */ +#undef HS_FEAT_ICAP + + + +/* + * ICAP - Internet Content Adaptation Protocol + */ +#undef HS_FEAT_ICAP + + /* * If you want to log User-Agent request header values, define this. * By default, they are written to useragent.log in the Squid log Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.52 retrieving revision 1.52.2.1 diff -u -r1.52 -r1.52.2.1 --- squid/configure.in 13 Apr 2002 23:09:52 -0000 1.52 +++ squid/configure.in 18 Apr 2002 07:36:50 -0000 1.52.2.1 @@ -3,7 +3,7 @@ dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.52 2002/04/13 23:09:52 squidadm Exp $ +dnl $Id: configure.in,v 1.52.2.1 2002/04/18 07:36:50 geetham Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE(squid, 2.6-DEVEL) AM_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.52 $)dnl +AC_REVISION($Revision: 1.52.2.1 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -458,6 +458,18 @@ fi ]) +dnl Enable ICAP Support +AM_CONDITIONAL(USE_ICAP, false) +AC_ARG_ENABLE(icap-support, +[ --enable-icap-support Enable iCAP client capability], +[ if test "$enableval" = "yes" ; then + echo "ICAP support enabled" + AC_DEFINE(HS_FEAT_ICAP) + AM_CONDITIONAL(USE_ICAP, true) + fi +]) + + dnl This is a developer only option. Developers know how to set defines dnl dnl AC_ARG_ENABLE(mem-gen-trace, Index: squid/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Makefile.am,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -r1.19 -r1.19.2.1 --- squid/src/Makefile.am 14 Apr 2002 23:07:00 -0000 1.19 +++ squid/src/Makefile.am 18 Apr 2002 07:36:51 -0000 1.19.2.1 @@ -6,6 +6,12 @@ # Uncomment and customize the following to suit your needs: # +if USE_ICAP +ICAPSOURCE = icap.c +else +ICAPSOURCE = +endif + if USE_DNSSERVER DNSSOURCE = dns.c DNSSERVER = dnsserver @@ -91,6 +97,7 @@ dnsserver.c \ dns_internal.c \ htcp.c \ + icap.c \ leakfinder.c \ snmp_core.c \ snmp_agent.c \ @@ -144,6 +151,7 @@ HttpMsg.c \ HttpReply.c \ HttpRequest.c \ + $(ICAPSOURCE) \ icmp.c \ icp_v2.c \ icp_v3.c \ Index: squid/src/cbdata.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cbdata.c,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -r1.15 -r1.15.2.1 --- squid/src/cbdata.c 13 Apr 2002 23:09:15 -0000 1.15 +++ squid/src/cbdata.c 18 Apr 2002 07:36:51 -0000 1.15.2.1 @@ -1,6 +1,6 @@ /* - * $Id: cbdata.c,v 1.15 2002/04/13 23:09:15 squidadm Exp $ + * $Id: cbdata.c,v 1.15.2.1 2002/04/18 07:36:51 geetham Exp $ * * DEBUG: section 45 Callback Data Registry * ORIGINAL AUTHOR: Duane Wessels @@ -133,6 +133,9 @@ CREATE_CBDATA(statefulhelper); CREATE_CBDATA(helper_stateful_server); CREATE_CBDATA(HttpStateData); +#ifdef HS_FEAT_ICAP + CREATE_CBDATA(IcapStateData); +#endif CREATE_CBDATA_FREE(peer, peerDestroy); CREATE_CBDATA(ps_state); CREATE_CBDATA(RemovalPolicy); Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.59 retrieving revision 1.59.2.1 diff -u -r1.59 -r1.59.2.1 --- squid/src/cf.data.pre 13 Apr 2002 22:33:33 -0000 1.59 +++ squid/src/cf.data.pre 18 Apr 2002 07:36:51 -0000 1.59.2.1 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.59 2002/04/13 22:33:33 squidadm Exp $ +# $Id: cf.data.pre,v 1.59.2.1 2002/04/18 07:36:51 geetham Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1984,7 +1984,7 @@ TYPE: acl_access LOC: Config.accessList.http DEFAULT: none -DEFAULT_IF_NONE: deny all +DEFAULT_IF_NONE: allow all DOC_START Allowing or Denying access based on defined access lists @@ -2065,7 +2065,7 @@ TYPE: acl_access LOC: Config.accessList.icp DEFAULT: none -DEFAULT_IF_NONE: deny all +DEFAULT_IF_NONE: allow all DOC_START Allowing or Denying access to the ICP port based on defined access lists @@ -3785,4 +3785,12 @@ until all the child processes have been started. DOC_END +NAME: icap_mode +TYPE: string +LOC: Config.icap_mode +DEFAULT: reqmod +DOC_START + Specify the mode of functioning for the ICAP client. + Can be one of "reqmod" or "respmod" +DOC_END EOF Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.58 retrieving revision 1.58.2.1 diff -u -r1.58 -r1.58.2.1 --- squid/src/client_side.c 14 Apr 2002 23:07:00 -0000 1.58 +++ squid/src/client_side.c 18 Apr 2002 07:36:51 -0000 1.58.2.1 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.58 2002/04/14 23:07:00 squidadm Exp $ + * $Id: client_side.c,v 1.58.2.1 2002/04/18 07:36:51 geetham Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -35,6 +35,20 @@ #include "squid.h" +/* I am using some of these functions in ICAP */ +#ifdef HS_FEAT_ICAP +#define STATIC +#else +#define STATIC static +#endif + +/* I am using some of these functions in ICAP */ +#ifdef HS_FEAT_ICAP +#define STATIC +#else +#define STATIC static +#endif + #if IPF_TRANSPARENT #if HAVE_SYS_IOCTL_H #include @@ -89,15 +103,15 @@ static CWCB clientWriteComplete; static CWCB clientWriteBodyComplete; -static PF clientReadRequest; -static PF connStateFree; -static PF requestTimeout; +STATIC PF clientReadRequest; +STATIC PF connStateFree; +STATIC PF requestTimeout; static PF clientLifetimeTimeout; static int clientCheckTransferDone(clientHttpRequest *); static int clientGotNotEnough(clientHttpRequest *); static void checkFailureRatio(err_type, hier_code); static void clientProcessMiss(clientHttpRequest *); -static void clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep); +STATIC void clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep); static clientHttpRequest *parseHttpRequestAbort(ConnStateData * conn, const char *uri); static clientHttpRequest *parseHttpRequest(ConnStateData *, method_t *, int *, char **, size_t *); static RH clientRedirectDone; @@ -107,10 +121,10 @@ static int clientGetsOldEntry(StoreEntry * new, StoreEntry * old, request_t * request); static int checkAccelOnly(clientHttpRequest *); #if USE_IDENT -static IDCB clientIdentDone; +STATIC IDCB clientIdentDone; #endif static int clientOnlyIfCached(clientHttpRequest * http); -static STCB clientSendMoreData; +STATIC STCB clientSendMoreData; static STCB clientCacheHit; static void clientSetKeepaliveFlag(clientHttpRequest *); static void clientInterpretRequestHeaders(clientHttpRequest *); @@ -145,7 +159,7 @@ } #if USE_IDENT -static void +STATIC void clientIdentDone(const char *ident, void *data) { ConnStateData *conn = data; @@ -393,7 +407,9 @@ * it is not, then the beginning of the object data might get * freed from memory before we need to access it. */ +#ifndef HS_FEAT_ICAP assert(http->sc->callback_data == http); +#endif entry = storeCreateEntry(url, http->log_uri, http->request->flags, @@ -866,7 +882,7 @@ } /* This is a handler normally called by comm_close() */ -static void +STATIC void connStateFree(int fd, void *data) { ConnStateData *connState = data; @@ -1142,7 +1158,7 @@ * adds extra entries if we have more info than origin server * adds Squid specific entries */ -static void +STATIC void clientBuildReplyHeader(clientHttpRequest * http, HttpReply * rep) { HttpHeader *hdr = &rep->header; @@ -1242,7 +1258,7 @@ httpHdrMangleList(hdr, request); } -static HttpReply * +STATIC HttpReply * clientBuildReply(clientHttpRequest * http, const char *buf, size_t size) { HttpReply *rep = httpReplyCreate(); @@ -1512,7 +1528,7 @@ * accepts chunk of a http message in buf, parses prefix, filters headers and * such, writes processed message to the client's socket */ -static void +STATIC void clientSendMoreData(void *data, char *retbuf, ssize_t retsize) { clientHttpRequest *http = data; @@ -1762,7 +1778,7 @@ if (http->out.size > 0x7FFF0000) { debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn->peer.sin_addr)); - debug(33, 1) ("\treceived %d bytes\n", (int)http->out.size); + debug(33, 1) ("\treceived %d bytes\n", (int) http->out.size); debug(33, 1) ("\tURI %s\n", http->log_uri); comm_close(fd); } else @@ -1771,8 +1787,8 @@ if (http->out.offset > 0x7FFF0000) { debug(33, 1) ("WARNING: closing FD %d to prevent counter overflow\n", fd); debug(33, 1) ("\tclient %s\n", inet_ntoa(http->conn->peer.sin_addr)); - debug(33, 1) ("\treceived %d bytes (offset %d)\n", (int)http->out.size, - (int)http->out.offset); + debug(33, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size, + (int) http->out.offset); debug(33, 1) ("\tURI %s\n", http->log_uri); comm_close(fd); } else @@ -2394,7 +2410,7 @@ return http; } -static int +STATIC int clientReadDefer(int fdnotused, void *data) { ConnStateData *conn = data; @@ -2404,7 +2420,7 @@ return conn->defer.until > squid_curtime; } -static void +STATIC void clientReadRequest(int fd, void *data) { ConnStateData *conn = data; @@ -2614,7 +2630,15 @@ break; } } - clientAccessCheck(http); +#ifdef HS_FEAT_ICAP + /* I need to read the modified request header from icap server - + * allow me. If it has come through Accept go ahead and service.. + * else don;t */ + if (conn->me.sin_family) +#endif + { + clientAccessCheck(http); + } continue; /* while offset > 0 && body.size_left == 0 */ } else if (parser_return_code == 0) { /* @@ -2763,7 +2787,7 @@ } /* general lifetime handler for HTTP requests */ -static void +STATIC void requestTimeout(int fd, void *data) { #if THIS_CONFUSES_PERSISTENT_CONNECTION_AWARE_BROWSERS_AND_USERS Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.32 retrieving revision 1.32.6.1 diff -u -r1.32 -r1.32.6.1 --- squid/src/enums.h 3 Apr 2002 08:55:03 -0000 1.32 +++ squid/src/enums.h 18 Apr 2002 07:36:55 -0000 1.32.6.1 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.32 2002/04/03 08:55:03 squidadm Exp $ + * $Id: enums.h,v 1.32.6.1 2002/04/18 07:36:55 geetham Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -708,9 +708,24 @@ CBDATA_RemovalPolicyWalker, CBDATA_RemovalPurgeWalker, CBDATA_store_client, +#ifdef HS_FEAT_ICAP + CBDATA_IcapStateData, +#endif CBDATA_FIRST_CUSTOM_TYPE = 1000 } cbdata_type; + +/* + * ICAP states: Mainly required for Preview support for RESPMOD. + */ +typedef enum { + ICAP_OK, + ICAP_RQ_DONE, /* Reqmod over */ + ICAP_PREVIEWED, /* Respmod preview over */ + ICAP_OVER, /* Last chunk has been sent */ + ICAP_RS_DONE /* Respmod over */ +} icapState; + /* * Return codes from checkVary(request) */ Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/forward.c,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -u -r1.15 -r1.15.2.1 --- squid/src/forward.c 13 Apr 2002 23:09:17 -0000 1.15 +++ squid/src/forward.c 18 Apr 2002 07:36:55 -0000 1.15.2.1 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.15 2002/04/13 23:09:17 squidadm Exp $ + * $Id: forward.c,v 1.15.2.1 2002/04/18 07:36:55 geetham Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -36,11 +36,18 @@ #include "squid.h" +/* I am using some of these functions in ICAP */ +#ifdef HS_FEAT_ICAP +#define STATIC +#else +#define STATIC static +#endif + static PSC fwdStartComplete; static void fwdDispatch(FwdState *); static void fwdConnectStart(void *); /* should be same as EVH */ -static void fwdStateFree(FwdState * fwdState); -static PF fwdConnectTimeout; +STATIC void fwdStateFree(FwdState * fwdState); +STATIC PF fwdConnectTimeout; static PF fwdServerClosed; static CNCB fwdConnectDone; static int fwdCheckRetry(FwdState * fwdState); @@ -76,7 +83,7 @@ memFree(fs, MEM_FWD_SERVER); } -static void +STATIC void fwdStateFree(FwdState * fwdState) { StoreEntry *e = fwdState->entry; @@ -239,7 +246,7 @@ current = NULL; } -static void +STATIC void fwdConnectTimeout(int fd, void *data) { FwdState *fwdState = data; Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.20 retrieving revision 1.20.10.1 diff -u -r1.20 -r1.20.10.1 --- squid/src/http.c 27 Feb 2002 09:16:52 -0000 1.20 +++ squid/src/http.c 18 Apr 2002 07:36:56 -0000 1.20.10.1 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.20 2002/02/27 09:16:52 squidadm Exp $ + * $Id: http.c,v 1.20.10.1 2002/04/18 07:36:56 geetham Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -45,17 +45,25 @@ static CWCB httpSendComplete; static CWCB httpSendRequestEntry; -static PF httpReadReply; -static void httpSendRequest(HttpStateData *); -static PF httpStateFree; -static PF httpTimeout; +/* I am using some of these functions in ICAP */ +#ifdef HS_FEAT_ICAP +#define STATIC +#define ICAP_FIELD(httpState) (httpState)->icap +#else +#define STATIC static +#endif + +STATIC PF httpReadReply; +STATIC void httpSendRequest(HttpStateData *); +STATIC PF httpStateFree; +STATIC PF httpTimeout; static void httpCacheNegatively(StoreEntry *); static void httpMakePrivate(StoreEntry *); static void httpMakePublic(StoreEntry *); static int httpCachableReply(HttpStateData *); static void httpMaybeRemovePublic(StoreEntry *, http_status); -static void +STATIC void httpStateFree(int fd, void *data) { HttpStateData *httpState = data; @@ -64,6 +72,7 @@ #endif if (httpState == NULL) return; + debug(11, 0) ("httpStateFree: FD %d, httpState = %p\n", fd, data); storeUnlockObject(httpState->entry); if (httpState->reply_hdr) { memFree(httpState->reply_hdr, MEM_8K_BUF); @@ -86,7 +95,7 @@ return 1; } -static void +STATIC void httpTimeout(int fd, void *data) { HttpStateData *httpState = data; @@ -493,8 +502,6 @@ * If we didn't send a keep-alive request header, then this * can not be a persistent connection. */ - if (!httpState->flags.keepalive) - return 0; /* * What does the reply have to say about keep-alive? */ @@ -516,22 +523,28 @@ return 0; clen = httpReplyBodySize(httpState->request->method, reply); /* If there is no message body, we can be persistent */ - if (0 == clen) + if (0 == clen) { + debug(11, 3) ("GEE:httpPconnTransferDone: FD %d no content returning 1\n", httpState->fd); return 1; + } /* If the body size is unknown we must wait for EOF */ if (clen < 0) return 0; + + /* If the body size is known, we must wait until we've gotten all of it. */ if (mem->inmem_hi < reply->content_length + reply->hdr_sz) return 0; /* We got it all */ + debug(11, 3) ("GEE:httpPconnTransferDone: FD %d we got it all %d %d %d\n", + httpState->fd, mem->inmem_hi, reply->content_length, reply->hdr_sz); return 1; } /* This will be called when data is ready to be read from fd. Read until * error or connection closed. */ /* XXX this function is too long! */ -static void +STATIC void httpReadReply(int fd, void *data) { HttpStateData *httpState = data; @@ -551,6 +564,7 @@ else delay_id = delayMostBytesAllowed(entry->mem_obj); #endif + debug(11, 5) ("httpReadReply: FD %d: httpState %p.\n", fd, data); if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { comm_close(fd); return; @@ -571,7 +585,11 @@ #endif kb_incr(&statCounter.server.all.kbytes_in, len); kb_incr(&statCounter.server.http.kbytes_in, len); +#ifdef HS_FEAT_ICAP + commSetTimeout(fd, Config.Timeout.read, httpTimeout, httpState); +#else commSetTimeout(fd, Config.Timeout.read, NULL, NULL); +#endif IOStats.Http.reads++; for (clen = len - 1, bin = 0; clen; bin++) clen >>= 1; @@ -621,6 +639,12 @@ * we want to process the reply headers. */ httpProcessReplyHeader(httpState, buf, len); +#ifdef HS_FEAT_ICAP + if (ICAP_FIELD(httpState)) { + icapSendRespMod(httpState, buf, len, 1); + return; + } +#endif fwdComplete(httpState->fwd); comm_close(fd); } else { @@ -640,6 +664,7 @@ } } storeAppend(entry, buf, len); + debug(11, 5) ("httpReadReply: after storeAppend FD %d read %d\n", fd, len); if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* * the above storeAppend() call could ABORT this entry, @@ -649,6 +674,12 @@ (void) 0; } else if (httpPconnTransferDone(httpState)) { /* yes we have to clear all these! */ +#ifdef HS_FEAT_ICAP + if (ICAP_FIELD(httpState)) { + icapSendRespMod(httpState, buf, len, 1); + return; + } +#endif commSetDefer(fd, NULL, NULL); commSetTimeout(fd, -1, NULL, NULL); commSetSelect(fd, COMM_SELECT_READ, NULL, NULL, 0); @@ -662,8 +693,13 @@ httpState->fd = -1; httpStateFree(fd, httpState); } else { - /* Wait for EOF condition */ - commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0); +#ifdef HS_FEAT_ICAP + if (ICAP_FIELD(httpState)) { + icapSendRespMod(httpState, buf, len, 0); + } else +#endif + /* Wait for EOF condition */ + commSetSelect(fd, COMM_SELECT_READ, httpReadReply, httpState, 0); } } } @@ -707,7 +743,13 @@ * request bodies. */ commSetTimeout(fd, Config.Timeout.read, httpTimeout, httpState); +#ifdef HS_FEAT_ICAP + /* Read fully - don't put limits on the read ahead count */ + /* Oh! I broke my head for this */ + commSetDefer(fd, NULL, NULL); +#else commSetDefer(fd, fwdCheckDeferRead, entry); +#endif } } @@ -868,8 +910,11 @@ if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) { const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request); httpHdrCcSetMaxAge(cc, getMaxAge(url)); +#ifndef HS_FEAT_ICAP + /* Don;t bother - if the url you want to cache is redirected? */ if (strLen(request->urlpath)) assert(strstr(url, strBuf(request->urlpath))); +#endif } if (flags.only_if_cached) EBIT_SET(cc->mask, CC_ONLY_IF_CACHED); @@ -918,7 +963,7 @@ return mb->size - offset; } /* This will be called when connect completes. Write request. */ -static void +STATIC void httpSendRequest(HttpStateData * httpState) { MemBuf mb; @@ -1015,12 +1060,29 @@ httpState->request = requestLink(orig_req); httpState->orig_request = requestLink(orig_req); } +#ifdef HS_FEAT_ICAP +#if 0 + if (Config.icap && !strcmp(Config.icap, "respmod")) { + startICAPrespmod(httpState); + } else { + if (startICAPreqmod(httpState) >= 0) + return; + } +#else + { + extern int (*startICAPmod) (); + if (startICAPmod && startICAPmod(httpState) >= 0) + return; + } +#endif +#endif /* * register the handler to free HTTP state data when the FD closes */ comm_add_close_handler(fd, httpStateFree, httpState); statCounter.server.all.requests++; statCounter.server.http.requests++; + httpSendRequest(httpState); /* * We used to set the read timeout here, but not any more. Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.32 retrieving revision 1.32.4.1 diff -u -r1.32 -r1.32.4.1 --- squid/src/main.c 6 Apr 2002 11:34:50 -0000 1.32 +++ squid/src/main.c 18 Apr 2002 07:36:56 -0000 1.32.4.1 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.32 2002/04/06 11:34:50 squidadm Exp $ + * $Id: main.c,v 1.32.4.1 2002/04/18 07:36:56 geetham Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -114,7 +114,7 @@ extern char *optarg; int c; - while ((c = getopt(argc, argv, "CDFNRSVYXa:d:f:hk:m::su:vz?")) != -1) { + while ((c = getopt(argc, argv, "CDFNRSVYXa:d:f:hi::k:m::su:vz?")) != -1) { switch (c) { case 'C': opt_catch_signals = 0; @@ -157,6 +157,11 @@ case 'h': usage(); break; +#ifdef HS_FEAT_ICAP + case 'i': + enable_icap(optarg); + break; +#endif case 'k': if ((int) strlen(optarg) < 1) usage(); @@ -360,6 +365,9 @@ idnsInit(); #endif redirectInit(); +#ifdef HS_FEAT_ICAP + initICAP(); +#endif authenticateInit(&Config.authConfig); #if USE_WCCP wccpInit(); @@ -401,6 +409,9 @@ dnsInit(); #endif redirectInit(); +#ifdef HS_FEAT_ICAP + initICAP(); +#endif authenticateInit(&Config.authConfig); } @@ -482,6 +493,9 @@ idnsInit(); #endif redirectInit(); +#ifdef HS_FEAT_ICAP + initICAP(); +#endif authenticateInit(&Config.authConfig); useragentOpenLog(); refererOpenLog(); Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -r1.12 -r1.12.2.1 --- squid/src/store_client.c 13 Apr 2002 23:09:17 -0000 1.12 +++ squid/src/store_client.c 18 Apr 2002 07:36:56 -0000 1.12.2.1 @@ -1,6 +1,8 @@ + + /* - * $Id: store_client.c,v 1.12 2002/04/13 23:09:17 squidadm Exp $ + * $Id: store_client.c,v 1.12.2.1 2002/04/18 07:36:56 geetham Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.55 retrieving revision 1.55.2.1 diff -u -r1.55 -r1.55.2.1 --- squid/src/structs.h 13 Apr 2002 23:09:17 -0000 1.55 +++ squid/src/structs.h 18 Apr 2002 07:37:01 -0000 1.55.2.1 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.55 2002/04/13 23:09:17 squidadm Exp $ + * $Id: structs.h,v 1.55.2.1 2002/04/18 07:37:01 geetham Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -684,6 +684,9 @@ } warnings; char *store_dir_select_algorithm; int sleep_after_fork; /* microseconds */ +#ifdef HS_FEAT_ICAP + char *icap_mode; +#endif }; struct _SquidConfig2 { @@ -961,6 +964,15 @@ unsigned int only_if_cached:1; }; +#ifdef HS_FEAT_ICAP +struct _IcapStateData { + int icap_fd; + int sc; + icapState state; +}; + +#endif + struct _HttpStateData { StoreEntry *entry; request_t *request; @@ -973,6 +985,9 @@ int fd; http_state_flags flags; FwdState *fwd; +#ifdef HS_FEAT_ICAP + struct _IcapStateData *icap; +#endif }; struct _icpUdpData { @@ -1615,6 +1630,9 @@ unsigned int internal:1; unsigned int body_sent:1; unsigned int reset_tcp:1; +#ifdef HS_FEAT_ICAP + unsigned int icap_done:1; +#endif }; struct _link_list { Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.26 retrieving revision 1.26.4.1 diff -u -r1.26 -r1.26.4.1 --- squid/src/typedefs.h 6 Apr 2002 11:34:50 -0000 1.26 +++ squid/src/typedefs.h 18 Apr 2002 07:37:06 -0000 1.26.4.1 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.26 2002/04/06 11:34:50 squidadm Exp $ + * $Id: typedefs.h,v 1.26.4.1 2002/04/18 07:37:06 geetham Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -105,6 +105,9 @@ typedef struct _HttpBody HttpBody; typedef struct _HttpReply HttpReply; typedef struct _HttpStateData HttpStateData; +#ifdef HS_FEAT_ICAP +typedef struct _IcapStateData IcapStateData; +#endif typedef struct _icpUdpData icpUdpData; typedef struct _clientHttpRequest clientHttpRequest; typedef struct _ConnStateData ConnStateData;