--------------------- PatchSet 3468 Date: 2001/12/14 08:00:36 Author: jkay Branch: push Tag: (none) Log: Version in which basic push works. Usually. Members: acconfig.h:1.12.2.1->1.12.2.2 configure.in:1.35.2.1->1.35.2.2 src/Makefile.am:1.8.2.2->1.8.2.3 src/cache_cf.c:1.38.2.1->1.38.2.2 src/client_side.c:1.45.2.2->1.45.2.3 src/comm.c:1.18.2.1->1.18.2.2 src/dist.c:1.1.2.2->1.1.2.3 src/enums.h:1.27.2.2->1.27.2.3 src/http.c:1.17.2.1->1.17.2.2 src/icp_v2.c:1.5.14.1->1.5.14.2 src/icp_v3.c:1.4.44.1->1.4.44.2 src/main.c:1.28.2.2->1.28.2.3 src/protos.h:1.41.2.2->1.41.2.3 src/put.c:1.1.2.3->1.1.2.4 src/stat.c:1.13.2.1->1.13.2.2 src/store_key_md5.c:1.6->1.6.24.1 src/structs.h:1.47.2.2->1.47.2.3 src/typedefs.h:1.25.2.2->1.25.2.3 src/url.c:1.7.2.1->1.7.2.2 src/webpush.c:1.1.2.1->1.1.2.2 Index: squid/acconfig.h =================================================================== RCS file: /cvsroot/squid-sf//squid/Attic/acconfig.h,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.2 diff -u -r1.12.2.1 -r1.12.2.2 --- squid/acconfig.h 7 Dec 2001 23:25:31 -0000 1.12.2.1 +++ squid/acconfig.h 14 Dec 2001 08:00:36 -0000 1.12.2.2 @@ -23,7 +23,7 @@ #ifndef __CONFIGURE_H__ #define __CONFIGURE_H__ @TOP@ -/* $Id: acconfig.h,v 1.12.2.1 2001/12/07 23:25:31 jkay Exp $ */ +/* $Id: acconfig.h,v 1.12.2.2 2001/12/14 08:00:36 jkay Exp $ */ /* * configure command line used to configure Squid @@ -145,7 +145,7 @@ /* * Define this to include code for sending data by ICP */ -#undef USE_ICPDATA +#undef USE_ICP_DATA /* * Define this to include code for the Hypertext Cache Protocol (HTCP) Index: squid/configure.in =================================================================== RCS file: /cvsroot/squid-sf//squid/configure.in,v retrieving revision 1.35.2.1 retrieving revision 1.35.2.2 diff -u -r1.35.2.1 -r1.35.2.2 --- squid/configure.in 7 Dec 2001 23:25:31 -0000 1.35.2.1 +++ squid/configure.in 14 Dec 2001 08:00:36 -0000 1.35.2.2 @@ -3,7 +3,7 @@ dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.35.2.1 2001/12/07 23:25:31 jkay Exp $ +dnl $Id: configure.in,v 1.35.2.2 2001/12/14 08:00:36 jkay Exp $ dnl dnl dnl @@ -11,7 +11,7 @@ AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE(Squid, 2.5-DEVEL) AM_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.35.2.1 $)dnl +AC_REVISION($Revision: 1.35.2.2 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -569,13 +569,13 @@ fi ]) -AM_CONDITIONAL(ENABLE_ICPDATA, false) +AM_CONDITIONAL(ENABLE_ICP_DATA, false) AC_ARG_ENABLE(icpdata, [ --enable-icpdata Enable sending data by ICP], [ if test "$enableval" = "yes" ; then echo "Push over ICP/UDP enabled" - AC_DEFINE(USE_ICPDATA) - AM_CONDITIONAL(ENABLE_ICPDATA, true) + AC_DEFINE(USE_ICP_DATA) + AM_CONDITIONAL(ENABLE_ICP_DATA, true) fi ]) Index: squid/src/Makefile.am =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Makefile.am,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -u -r1.8.2.2 -r1.8.2.3 --- squid/src/Makefile.am 7 Dec 2001 23:25:31 -0000 1.8.2.2 +++ squid/src/Makefile.am 14 Dec 2001 08:00:36 -0000 1.8.2.3 @@ -72,8 +72,8 @@ PLAXSOURCE = endif -if ENABLE_ICPDATA -ICPDATASOURCE = icpdata.c +if ENABLE_ICP_DATA +ICPDATASOURCE = icp_data.c else ICPDATASOURCE = endif Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.38.2.1 retrieving revision 1.38.2.2 diff -u -r1.38.2.1 -r1.38.2.2 --- squid/src/cache_cf.c 7 Dec 2001 23:25:31 -0000 1.38.2.1 +++ squid/src/cache_cf.c 14 Dec 2001 08:00:36 -0000 1.38.2.2 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.38.2.1 2001/12/07 23:25:31 jkay Exp $ + * $Id: cache_cf.c,v 1.38.2.2 2001/12/14 08:00:36 jkay Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -1466,7 +1466,7 @@ } else if (!strncasecmp(token, "fwdpush", 7)) { p->fwdpush = DistAllPeers; DistAllPeers = p; -#if USE_ICPDATA +#if USE_ICP_DATA } else if (!strncasecmp(token, "icpdata", 7)) { p->options.icpdata = 1; } else if (!strncasecmp(token, "maxrate=", 8)) { Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.45.2.2 retrieving revision 1.45.2.3 diff -u -r1.45.2.2 -r1.45.2.3 --- squid/src/client_side.c 7 Dec 2001 23:25:32 -0000 1.45.2.2 +++ squid/src/client_side.c 14 Dec 2001 08:00:36 -0000 1.45.2.3 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.45.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: client_side.c,v 1.45.2.3 2001/12/14 08:00:36 jkay Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2322,7 +2322,7 @@ else { /* DIST_UNDIST */ assert(r->dist_type == DIST_UNDIST); - distUndist(http->entry, r->client_addr, r->dist_port); + distDelUpdatee(http->entry, r->client_addr, r->dist_port); } } #if DELAY_POOLS Index: squid/src/comm.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm.c,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.2 diff -u -r1.18.2.1 -r1.18.2.2 --- squid/src/comm.c 7 Dec 2001 23:25:32 -0000 1.18.2.1 +++ squid/src/comm.c 14 Dec 2001 08:00:36 -0000 1.18.2.2 @@ -1,6 +1,6 @@ /* - * $Id: comm.c,v 1.18.2.1 2001/12/07 23:25:32 jkay Exp $ + * $Id: comm.c,v 1.18.2.2 2001/12/14 08:00:36 jkay Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -618,7 +618,7 @@ comm_close(int fd) { fde *F = NULL; -#if USE_ICPDATA +#if USE_ICP_DATA int isvfd; #endif @@ -638,7 +638,7 @@ if (F->ssl) ssl_shutdown_method(fd); #endif -#if USE_ICPDATA +#if USE_ICP_DATA isvfd = (conn->comm_type == SOCK_VIRTUAL); #endif CommWriteStateCallbackAndFree(fd, COMM_ERR_CLOSING); @@ -652,7 +652,7 @@ } #endif fd_close(fd); /* update fdstat */ -#if USE_ICPDATA +#if USE_ICP_DATA if (isvfd) { /* flag for later reuse */ conn->comm_type = SOCK_VIRTUAL; @@ -661,9 +661,9 @@ debug(5, 9) ("comm_close: really closing fd %d \n", fd); close(fd); } -#else /* USE_ICPDATA */ +#else /* USE_ICP_DATA */ close(fd); -#endif /* USE_ICPDATA */ +#endif /* USE_ICP_DATA */ statCounter.syscalls.sock.closes++; } @@ -1017,7 +1017,7 @@ } } -#if USE_ICPDATA +#if USE_ICP_DATA /* * Get fake file descriptor suitable for indexing through fd_table. */ @@ -1060,4 +1060,4 @@ return(vfd); } -#endif /* USE_ICPDATA */ +#endif /* USE_ICP_DATA */ Index: squid/src/dist.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/dist.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid/src/dist.c 7 Dec 2001 23:25:32 -0000 1.1.2.2 +++ squid/src/dist.c 14 Dec 2001 08:00:37 -0000 1.1.2.3 @@ -1,5 +1,5 @@ /* - * $Id: dist.c,v 1.1.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: dist.c,v 1.1.2.3 2001/12/14 08:00:37 jkay Exp $ * * Distribution network algorithm. * @@ -38,7 +38,7 @@ /* Create new updatee ds & add to object's updatee list */ Updatee * -distNewUpdatee(StoreEntry *entry, struct in_addr host, int dport) +distNewUpdatee(StoreEntry *entry, struct in_addr host, u_short dport) { Updatee *u; @@ -97,6 +97,15 @@ } } +void +distUpdateeChangeEntry(StoreEntry *entry, Updatee *u) +{ + entry->updatees = u; + for ( ; u; u = u->next) { + u->entry = entry; + } +} + /* Code to distribute contents of entry to updatees */ @@ -116,20 +125,31 @@ /* Distribute entry contents to anybody interested */ void -distEntryUpdate(StoreEntry *entry, request_t *req, struct sockaddr_in *peer) +distEntryUpdate(StoreEntry *entry, request_t *req, struct sockaddr_in *src) { - struct sockaddr_in *me = &Config.Sockaddr.http->s; Updatee *u; ++statCounter.dist.content_upd; - + /* Open distribution socket to everybody interested */ for (u = entry->updatees; u; u = u->next) { - if (!req || !req->dist_port - || req->dist_port != u->saddr.sin_port - || peer->sin_addr.s_addr != me->sin_addr.s_addr) - /* Send if got a dist and it isn't to where we got this update */ - distUpdate(u); + assert(req); + + /* Don't send updates back from where they came */ + if (src && src->sin_addr.s_addr == u->saddr.sin_addr.s_addr + && src->sin_port == u->saddr.sin_port) + return; + + /* Don't send updates to GET-requesting clients, + when we happen to know their identity. We do + know with other peers and on DIST reqs. */ + if (req->dist_type == DIST_DIST + && req->dist_port == u->saddr.sin_port + && req->my_addr.s_addr == u->saddr.sin_addr.s_addr) + return; + + /* No problems here - send it on out */ + distUpdate(u); } } Index: squid/src/enums.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/enums.h,v retrieving revision 1.27.2.2 retrieving revision 1.27.2.3 diff -u -r1.27.2.2 -r1.27.2.3 --- squid/src/enums.h 7 Dec 2001 23:25:32 -0000 1.27.2.2 +++ squid/src/enums.h 14 Dec 2001 08:00:37 -0000 1.27.2.3 @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.27.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: enums.h,v 1.27.2.3 2001/12/14 08:00:37 jkay Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -94,6 +94,7 @@ ERR_FTP_UNAVAILABLE, ERR_ONLY_IF_CACHED_MISS, /* failure to satisfy only-if-cached request */ ERR_TOO_BIG, + ERR_CONFLICT, ERR_MAX } err_type; Index: squid/src/http.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/http.c,v retrieving revision 1.17.2.1 retrieving revision 1.17.2.2 diff -u -r1.17.2.1 -r1.17.2.2 --- squid/src/http.c 7 Dec 2001 23:25:32 -0000 1.17.2.1 +++ squid/src/http.c 14 Dec 2001 08:00:37 -0000 1.17.2.2 @@ -1,6 +1,6 @@ /* - * $Id: http.c,v 1.17.2.1 2001/12/07 23:25:32 jkay Exp $ + * $Id: http.c,v 1.17.2.2 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -631,8 +631,11 @@ httpState->body_remain -= len; debug(50, 7) ("httpReadReply: body_remain = %d (len %d, state %d)\n", httpState->body_remain, len, httpState->reply_hdr_state); - if (len > 0) + if (len > 0) { storeAppend(entry, buf, len); + distEntryUpdate(entry, entry->mem_obj->request, + httpState->peer ? &httpState->peer->in_addr : 0); + } if (entry->mem_obj->request && entry->mem_obj->request->method == METHOD_PUT) { putReplyAndClose(fd, entry); @@ -662,6 +665,8 @@ httpState->body_remain -= len; debug(50, 8) ("httpReadReply: %d remain\n", httpState->body_remain); storeAppend(entry, buf, len); + distEntryUpdate(entry, entry->mem_obj->request, + httpState->peer ? &httpState->peer->in_addr : 0); if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* * the above storeAppend() call could ABORT this entry, @@ -1070,7 +1075,7 @@ if (peer->options.dist) { distNewUpdatee(httpState->entry, peer->in_addr.sin_addr, - peer->http_port); + peer->in_addr.sin_port); httpState->request->flags.distify = 1; } #if DELAY_POOLS @@ -1189,7 +1194,7 @@ httpState->body_remain = 0x7fffffff; assert(http->entry->lock_count >= 1); - /* Lock entry for a second time to reflect presence in http */ + /* Lock entry for a second time to reflect presence in httpState */ /* XXX - can't use storeLockObject() because is NOT_IN_MEMORY (!!!) */ httpState->entry->lock_count++; assert(http->entry->lock_count >= 2); Index: squid/src/icp_v2.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icp_v2.c,v retrieving revision 1.5.14.1 retrieving revision 1.5.14.2 diff -u -r1.5.14.1 -r1.5.14.2 --- squid/src/icp_v2.c 7 Dec 2001 23:25:32 -0000 1.5.14.1 +++ squid/src/icp_v2.c 14 Dec 2001 08:00:37 -0000 1.5.14.2 @@ -1,6 +1,6 @@ /* - * $Id: icp_v2.c,v 1.5.14.1 2001/12/07 23:25:32 jkay Exp $ + * $Id: icp_v2.c,v 1.5.14.2 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -302,7 +302,7 @@ neighborsUdpAck(key, &header, &from); break; -#if USE_ICPDATA +#if USE_ICP_DATA case ICP_OP_DATABEG: case ICP_OP_DATA: case ICP_OP_DATAEND: Index: squid/src/icp_v3.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/icp_v3.c,v retrieving revision 1.4.44.1 retrieving revision 1.4.44.2 diff -u -r1.4.44.1 -r1.4.44.2 --- squid/src/icp_v3.c 7 Dec 2001 23:25:32 -0000 1.4.44.1 +++ squid/src/icp_v3.c 14 Dec 2001 08:00:37 -0000 1.4.44.2 @@ -1,6 +1,6 @@ /* - * $Id: icp_v3.c,v 1.4.44.1 2001/12/07 23:25:32 jkay Exp $ + * $Id: icp_v3.c,v 1.4.44.2 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 12 Internet Cache Protocol * AUTHOR: Duane Wessels @@ -143,7 +143,7 @@ neighborsUdpAck(key, &header, &from); break; -#if USE_ICPDATA +#if USE_ICP_DATA case ICP_OP_DATABEG: case ICP_OP_DATA: case ICP_OP_DATAEND: Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.28.2.2 retrieving revision 1.28.2.3 diff -u -r1.28.2.2 -r1.28.2.3 --- squid/src/main.c 7 Dec 2001 23:25:32 -0000 1.28.2.2 +++ squid/src/main.c 14 Dec 2001 08:00:37 -0000 1.28.2.3 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.28.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: main.c,v 1.28.2.3 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -523,7 +523,7 @@ #if USE_HINT_CACHE hintCacheInit(); #endif -#if USE_ICPDATA +#if USE_ICP_DATA icpDataInit(); #endif fwdInit(); Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.41.2.2 retrieving revision 1.41.2.3 diff -u -r1.41.2.2 -r1.41.2.3 --- squid/src/protos.h 7 Dec 2001 23:25:32 -0000 1.41.2.2 +++ squid/src/protos.h 14 Dec 2001 08:00:37 -0000 1.41.2.3 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.41.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: protos.h,v 1.41.2.3 2001/12/14 08:00:37 jkay Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -174,9 +174,9 @@ extern void commSetDefer(int fd, DEFER * func, void *); extern int ignoreErrno(int); extern void commCloseAllSockets(void); -#if USE_ICPDATA +#if USE_ICP_DATA extern int comm_virtual_fd(void); -#endif /* USE_ICPDATA */ +#endif /* USE_ICP_DATA */ /* @@ -536,7 +536,7 @@ int reqnum, int pad); extern int icpUdpSend(int, const struct sockaddr_in *, icp_common_t *, log_type, int); -#if USE_ICPDATA +#if USE_ICP_DATA void icpSendData(int vfd, StoreEntry *entry, struct _pusher *p); void icpRecvData(int fd, struct sockaddr_in *src, icp_common_t *hdr, char *buf, int len); @@ -1117,7 +1117,8 @@ extern char *url_convert_hex(char *org_url, int allocate); extern char *url_escape(const char *url); -extern protocol_t urlParseProtocol(const char *, int *, int *); +extern protocol_t urlParseProtocol(const char *, u_short *, + int *); extern method_t urlParseMethod(const char *); extern void urlInitialize(void); extern request_t *urlParse(method_t, char *); @@ -1315,10 +1316,12 @@ /* dist.c */ extern Updatee *distNewUpdatee(StoreEntry *entry, - struct in_addr host, int dport); + struct in_addr host, u_short dport); +extern void distDelUpdatees(Updatee *u); +void +distUpdateeChangeEntry(StoreEntry *entry, Updatee *u); extern void distEntryUpdate(StoreEntry *e, request_t *req, struct sockaddr_in *peer); -extern void distDelUpdatees(Updatee *u); extern char *distifyUrl(char *url); extern void distInputDone(StoreEntry *); void distInit(); Index: squid/src/put.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/put.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid/src/put.c 10 Dec 2001 22:24:44 -0000 1.1.2.3 +++ squid/src/put.c 14 Dec 2001 08:00:37 -0000 1.1.2.4 @@ -1,5 +1,5 @@ /* - * $Id: put.c,v 1.1.2.3 2001/12/10 22:24:44 jkay Exp $ + * $Id: put.c,v 1.1.2.4 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 81 PUT transmission and reception * AUTHOR: Jon Kay, 1997 @@ -38,7 +38,8 @@ static PF putRecvFree; static void putReply(int fd, StoreEntry *entry); -static void putRecvError(clientHttpRequest *http, http_status entry); +static void putRecvError(clientHttpRequest *http, + err_type error, http_status entry); static void putProcessHeader(HttpStateData *, clientHttpRequest *); static void putHandleStore(void *data, char *buf, ssize_t len); static CNCB putConnected; @@ -57,6 +58,7 @@ const cache_key *pubkey; HttpReply *reply; int lastmod; + Updatee *uchain; peer *p; pubkey = storeKeyPublic(http->uri, request->method); @@ -68,6 +70,8 @@ entry = storeGet(pubkey); if (entry) { + uchain = entry->updatees; + entry->updatees = 0; storeSetPrivateKey(entry); storeRelease(entry); } @@ -82,6 +86,8 @@ requestLink(http->request); entry->mem_obj->request = request; + distUpdateeChangeEntry(entry, uchain); + debug(81, 4) ("putRecv: %s for '%s'\n", log_tags[http->log_type], http->uri); @@ -108,7 +114,7 @@ if (lastmod < entry->lastmod) { /* We do not accept old versions */ ++statCounter.put.conflicts; - putRecvError(http, HTTP_CONFLICT); + putRecvError(http, ERR_CONFLICT, HTTP_CONFLICT); return; } /* Note: it's OK to overwrite the same version. It just won't be @@ -238,12 +244,13 @@ } static void -putRecvError(clientHttpRequest *http, http_status entry) +putRecvError(clientHttpRequest *http, + err_type error, http_status status) { ErrorState *err; http->log_type = LOG_TCP_DENIED; - err = errorCon(ERR_ACCESS_DENIED, HTTP_CONFLICT); + err = errorCon(error, status); err->request = requestLink(http->request); err->src_addr = http->conn->peer.sin_addr; http->entry = clientCreateStoreEntry(http, http->request->method, null_request_flags); @@ -342,7 +349,7 @@ comm_close(fd); } -/* xlate storeRegister calling conventions to comm_write ones */ +/* xlate storeClientCopy calling conventions to comm_write ones */ static void putHandleStore(void *data, char *buf, ssize_t len) { Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -u -r1.13.2.1 -r1.13.2.2 --- squid/src/stat.c 7 Dec 2001 23:25:32 -0000 1.13.2.1 +++ squid/src/stat.c 14 Dec 2001 08:00:37 -0000 1.13.2.2 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.13.2.1 2001/12/07 23:25:32 jkay Exp $ + * $Id: stat.c,v 1.13.2.2 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -801,6 +801,32 @@ storeAppendPrintf(sentry, "aborted_requests = %f/sec\n", XAVG(aborted_requests)); + storeAppendPrintf(sentry, "dist.dists = %f/sec\n", + XAVG(dist.dists)); + storeAppendPrintf(sentry, "dist.undists = %f/sec\n", + XAVG(dist.undists)); + storeAppendPrintf(sentry, "dist.updates = %f/sec\n", + XAVG(dist.updates)); + storeAppendPrintf(sentry, "dist.update_kbytes = %f/sec\n", + XAVG(dist.update_kbytes.kb)); + storeAppendPrintf(sentry, "dist.content_upd = %f/sec\n", + XAVG(dist.content_upd)); + storeAppendPrintf(sentry, "dist.updatees = %f/sec\n", + XAVG(dist.updatees)); + storeAppendPrintf(sentry, "dist.updatees = %f/sec\n", + XAVG(dist.updatees * sizeof(Updatee))); + + storeAppendPrintf(sentry, "put.outs = %f/sec\n", + XAVG(put.outs)); + storeAppendPrintf(sentry, "put.kbytes_out = %f/sec\n", + (int) XAVG(put.kbytes_out.kb)); + storeAppendPrintf(sentry, "put.ins =: %d\n", + XAVG(put.ins)); + storeAppendPrintf(sentry, "put.kbytes_in = %f/sec\n", + (int) XAVG(put.kbytes_in.kb)); + storeAppendPrintf(sentry, "put.conflicts = %f/sec\n", + XAVG(put.conflicts)); + #if HAVE_POLL storeAppendPrintf(sentry, "syscalls.polls = %f/sec\n", XAVG(syscalls.polls)); #else @@ -1186,30 +1212,30 @@ f->aborted_requests); storeAppendPrintf(sentry, "dist.dists = %d\n", - statCounter.dist.dists); + f->dist.dists); storeAppendPrintf(sentry, "dist.undists = %d\n", - statCounter.dist.undists); + f->dist.undists); storeAppendPrintf(sentry, "dist.updates = %d\n", - statCounter.dist.updates); + f->dist.updates); storeAppendPrintf(sentry, "dist.update_kbytes = %d\n", - statCounter.dist.update_kbytes); + (int) f->dist.update_kbytes.kb); storeAppendPrintf(sentry, "dist.content_upd = %d\n", - statCounter.dist.content_upd); + f->dist.content_upd); storeAppendPrintf(sentry, "dist.updatees = %d\n", - statCounter.dist.updatees); + f->dist.updatees); storeAppendPrintf(sentry, "dist.updatees = %d\n", - statCounter.dist.updatees * sizeof(Updatee)); + f->dist.updatees * sizeof(Updatee)); storeAppendPrintf(sentry, "put.outs = %d\n", - statCounter.put.outs); + f->put.outs); storeAppendPrintf(sentry, "put.kbytes_out = %d\n", - (int) statCounter.put.kbytes_out.kb); + (int) f->put.kbytes_out.kb); storeAppendPrintf(sentry, "put.ins =: %d\n", - statCounter.put.ins); + f->put.ins); storeAppendPrintf(sentry, "put.kbytes_in = %d\n", - (int) statCounter.put.kbytes_in.kb); + (int) f->put.kbytes_in.kb); storeAppendPrintf(sentry, "put.conflicts = %d\n", - statCounter.put.conflicts); + f->put.conflicts); } void Index: squid/src/store_key_md5.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_key_md5.c,v retrieving revision 1.6 retrieving revision 1.6.24.1 diff -u -r1.6 -r1.6.24.1 --- squid/src/store_key_md5.c 14 Apr 2001 00:31:02 -0000 1.6 +++ squid/src/store_key_md5.c 14 Dec 2001 08:00:37 -0000 1.6.24.1 @@ -1,6 +1,6 @@ /* - * $Id: store_key_md5.c,v 1.6 2001/04/14 00:31:02 squidadm Exp $ + * $Id: store_key_md5.c,v 1.6.24.1 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 20 Storage Manager MD5 Cache Keys * AUTHOR: Duane Wessels @@ -99,6 +99,11 @@ assert(id > 0); debug(20, 3) ("storeKeyPrivate: %s %s\n", RequestMethodStr[method], url); + + /* PUT goes to same namespace as GETs do, so treat them alike here */ + if (method == METHOD_PUT) + method = METHOD_GET; + MD5Init(&M); MD5Update(&M, (unsigned char *) &id, sizeof(id)); MD5Update(&M, (unsigned char *) &method, sizeof(method)); @@ -113,6 +118,11 @@ static cache_key digest[MD5_DIGEST_CHARS]; unsigned char m = (unsigned char) method; MD5_CTX M; + + /* PUT goes to same namespace as GETs do, so treat them alike here */ + if (m == METHOD_PUT) + m = METHOD_GET; + MD5Init(&M); MD5Update(&M, &m, sizeof(m)); MD5Update(&M, (unsigned char *) url, strlen(url)); @@ -133,6 +143,11 @@ unsigned char m = (unsigned char) method; const char *url = urlCanonical(request); MD5_CTX M; + + /* PUT goes to same namespace as GETs do, so treat them alike here */ + if (m == METHOD_PUT) + m = METHOD_GET; + MD5Init(&M); MD5Update(&M, &m, sizeof(m)); MD5Update(&M, (unsigned char *) url, strlen(url)); Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.47.2.2 retrieving revision 1.47.2.3 diff -u -r1.47.2.2 -r1.47.2.3 --- squid/src/structs.h 7 Dec 2001 23:25:32 -0000 1.47.2.2 +++ squid/src/structs.h 14 Dec 2001 08:00:37 -0000 1.47.2.3 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.47.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: structs.h,v 1.47.2.3 2001/12/14 08:00:37 jkay Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1285,7 +1285,7 @@ #endif unsigned int allow_miss:1; unsigned int dist:1; -#if USE_ICPDATA +#if USE_ICP_DATA unsigned int icpdata:1; #endif #if USE_HINT_CACHE @@ -2225,7 +2225,7 @@ unsigned int writing:1; unsigned int dead:1; unsigned int disting:1; -#ifdef USE_ICPDATA +#ifdef USE_ICP_DATA unsigned int icpdata:1; #endif } flags; @@ -2234,7 +2234,7 @@ StoreEntry *entry; PF *handler; void *arg; -#ifdef USE_ICPDATA +#ifdef USE_ICP_DATA icpQueue *q; #endif unsigned reqnum; /* ICP reqnum */ @@ -2342,7 +2342,7 @@ #endif /* USE_HINT_CACHE */ -#if USE_ICPDATA +#if USE_ICP_DATA typedef struct _icpDataStats { int nsends; int nrecvs; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.25.2.2 retrieving revision 1.25.2.3 diff -u -r1.25.2.2 -r1.25.2.3 --- squid/src/typedefs.h 7 Dec 2001 23:25:32 -0000 1.25.2.2 +++ squid/src/typedefs.h 14 Dec 2001 08:00:37 -0000 1.25.2.3 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.25.2.2 2001/12/07 23:25:32 jkay Exp $ + * $Id: typedefs.h,v 1.25.2.3 2001/12/14 08:00:37 jkay Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -386,7 +386,7 @@ typedef List_Links *HintCacheNodeListIter; #endif /* USE_HINT_CACHE */ -#if USE_ICPDATA +#if USE_ICP_DATA typedef struct _icpDataStats icpDataStats; #endif Index: squid/src/url.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/url.c,v retrieving revision 1.7.2.1 retrieving revision 1.7.2.2 diff -u -r1.7.2.1 -r1.7.2.2 --- squid/src/url.c 7 Dec 2001 23:25:32 -0000 1.7.2.1 +++ squid/src/url.c 14 Dec 2001 08:00:37 -0000 1.7.2.2 @@ -1,6 +1,6 @@ /* - * $Id: url.c,v 1.7.2.1 2001/12/07 23:25:32 jkay Exp $ + * $Id: url.c,v 1.7.2.2 2001/12/14 08:00:37 jkay Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -194,54 +194,54 @@ protocol_t -urlParseProtocol(const char *s, int *dportp, int *dtypep) +urlParseProtocol(const char *s, u_short *dportp, int *dtypep) { int proto; /* test common stuff first */ - if (strcasecmp(s, "http") == 0) { + if (strncasecmp(s, "http", 4) == 0) { s += 4; proto = PROTO_HTTP; } #if USE_HINT_CACHE - else if (strcasecmp(s, "route") == 0) { + else if (strncasecmp(s, "route", 5) == 0) { s += 5; proto = PROTO_ROUTE; } #endif - else if (strcasecmp(s, "ftp") == 0) { + else if (strncasecmp(s, "ftp", 3) == 0) { s += 3; proto = PROTO_FTP; } - else if (strcasecmp(s, "https") == 0) { + else if (strncasecmp(s, "https", 5) == 0) { s += 5; proto = PROTO_HTTPS; } - else if (strcasecmp(s, "file") == 0) { + else if (strncasecmp(s, "file", 4) == 0) { s += 4; proto = PROTO_FTP; } - else if (strcasecmp(s, "gopher") == 0) { + else if (strncasecmp(s, "gopher", 6) == 0) { s += 6; proto = PROTO_GOPHER; } - else if (strcasecmp(s, "wais") == 0) { + else if (strncasecmp(s, "wais", 4) == 0) { s += 4; proto =PROTO_WAIS; } - else if (strcasecmp(s, "cache_object") == 0) { + else if (strncasecmp(s, "cache_object", 12) == 0) { s += 12; proto = PROTO_CACHEOBJ; } - else if (strcasecmp(s, "urn") == 0) { + else if (strncasecmp(s, "urn", 3) == 0) { s += 3; proto = PROTO_URN; } - else if (strcasecmp(s, "whois") == 0) { + else if (strncasecmp(s, "whois", 5) == 0) { s += 5; proto = PROTO_WHOIS; } - else if (strcasecmp(s, "internal") == 0) { + else if (strncasecmp(s, "internal", 8) == 0) { s += 8; proto = PROTO_INTERNAL; } @@ -252,14 +252,14 @@ if (strncasecmp(s, "dist", 4) == 0) { s += 4; if (dportp != NULL) - *dportp = atoi(s); + *dportp = ntohs(atoi(s)); if (dtypep) *dtypep = DIST_DIST; } else if (strncasecmp(s, "undist", 6) == 0) { s += 6; if (dportp != NULL) - *dportp = atoi(s); + *dportp = ntohs(atoi(s)); if (dtypep) *dtypep = DIST_UNDIST; } @@ -411,6 +411,7 @@ xstrncpy(request->login, login, MAX_LOGIN_SZ); request->port = (u_short) port; request->dist_port = (u_short) dport; + request->dist_type = dtype; return request; } Index: squid/src/webpush.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/webpush.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- squid/src/webpush.c 20 Nov 2001 23:04:51 -0000 1.1.2.1 +++ squid/src/webpush.c 14 Dec 2001 08:00:37 -0000 1.1.2.2 @@ -20,7 +20,7 @@ int puthdr(struct stat *st); void hfcopy(FILE *to, FILE *from, char *buf, int buflen, int hdrlen); -char *verstr = "Server: Webpost 1.0, Cuttlefish distribution\r\n"; +char *verstr = "Server: Webpush 2.0, Squid PUT utility\r\n"; static int port = 3128; static int verbose = 0; @@ -214,7 +214,9 @@ sprintf(outbuf + hdrlen, "Last-modified: %s GMT\r\n\r\n", timestr); hdrlen = strchr(outbuf + hdrlen, '\n') - outbuf + 3; - printf("PUT header amounts to %d bytes\n", hdrlen); + if (verbose) + printf("PUT header amounts to %d bytes\n", hdrlen); + return(hdrlen); }