--------------------- PatchSet 2473 Date: 2001/06/03 19:41:47 Author: serassio Branch: nt-2_3 Tag: (none) Log: Added some little Windows NT fixes Members: src/acl.c:1.1.1.3.4.3.2.1->1.1.1.3.4.3.2.2 src/authenticate.c:1.1.1.3.4.1.2.2->1.1.1.3.4.1.2.3 src/cache_cf.c:1.1.1.3.4.4.2.1->1.1.1.3.4.4.2.2 src/cache_diff.c:1.1.1.1.4.1.2.1->1.1.1.1.4.1.2.2 src/carp.c:1.1.1.1.4.4.2.1->1.1.1.1.4.4.2.2 src/cf.data.pre:1.1.1.3.4.3.2.1->1.1.1.3.4.3.2.2 src/cf_gen.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/client.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/client_side.c:1.1.1.3.4.6.2.1->1.1.1.3.4.6.2.2 src/comm.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/debug.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/dnsserver.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/main.c:1.1.1.3.4.2.2.2->1.1.1.3.4.2.2.3 src/mime.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/protos.h:1.1.1.3.4.1.2.2->1.1.1.3.4.1.2.3 src/squid.h:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/stat.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/store.c:1.1.1.3.4.5.2.1->1.1.1.3.4.5.2.2 src/store_dir.c:1.1.1.3.4.2.2.1->1.1.1.3.4.2.2.2 src/store_dir_ufs.c:1.1.1.1.4.1.2.1->1.1.1.1.4.1.2.2 src/structs.h:1.1.1.3.4.2.2.1->1.1.1.3.4.2.2.2 src/tools.c:1.1.1.3.4.1.2.2->1.1.1.3.4.1.2.3 src/typedefs.h:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 src/useragent.c:1.1.1.3.4.1.2.1->1.1.1.3.4.1.2.2 Index: squid/src/acl.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/acl.c,v retrieving revision 1.1.1.3.4.3.2.1 retrieving revision 1.1.1.3.4.3.2.2 diff -u -r1.1.1.3.4.3.2.1 -r1.1.1.3.4.3.2.2 --- squid/src/acl.c 6 Jan 2001 12:40:11 -0000 1.1.1.3.4.3.2.1 +++ squid/src/acl.c 3 Jun 2001 19:41:47 -0000 1.1.1.3.4.3.2.2 @@ -1,6 +1,6 @@ /* - * $Id: acl.c,v 1.1.1.3.4.3.2.1 2001/01/06 12:40:11 hno Exp $ + * $Id: acl.c,v 1.1.1.3.4.3.2.2 2001/06/03 19:41:47 serassio Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -120,6 +120,9 @@ debug(28, 0) ("strtokFile: %s not found\n", fn); return (NULL); } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(aclFile), O_TEXT); +#endif aclFromFile = 1; } else { return t; Index: squid/src/authenticate.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/authenticate.c,v retrieving revision 1.1.1.3.4.1.2.2 retrieving revision 1.1.1.3.4.1.2.3 diff -u -r1.1.1.3.4.1.2.2 -r1.1.1.3.4.1.2.3 --- squid/src/authenticate.c 25 Mar 2001 16:42:22 -0000 1.1.1.3.4.1.2.2 +++ squid/src/authenticate.c 3 Jun 2001 19:41:47 -0000 1.1.1.3.4.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: authenticate.c,v 1.1.1.3.4.1.2.2 2001/03/25 16:42:22 serassio Exp $ + * $Id: authenticate.c,v 1.1.1.3.4.1.2.3 2001/06/03 19:41:47 serassio Exp $ * * DEBUG: section 29 Authenticator * AUTHOR: Duane Wessels @@ -119,8 +119,8 @@ debug(29, 5) ("authenticateStart: '%s:%s'\n", auth_user->user, auth_user->passwd); if (Config.Program.authenticate == NULL) { - handler(data, NULL); - return; + handler(data, NULL); + return; } r = xcalloc(1, sizeof(authenticateStateData)); cbdataAdd(r, cbdataXfree, 0); @@ -187,7 +187,7 @@ authenticators->stats.replies=0; #else if (authenticators == NULL) - authenticators = helperCreate("authenticator"); + authenticators = helperCreate("authenticator"); authenticators->cmdline = Config.Program.authenticate; authenticators->n_to_start = Config.authenticateChildren; authenticators->ipc_type = IPC_TCP_SOCKET; @@ -212,7 +212,7 @@ #else helperShutdown(authenticators); if (!shutting_down) - return; + return; helperFree(authenticators); #endif authenticators = NULL; Index: squid/src/cache_cf.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_cf.c,v retrieving revision 1.1.1.3.4.4.2.1 retrieving revision 1.1.1.3.4.4.2.2 diff -u -r1.1.1.3.4.4.2.1 -r1.1.1.3.4.4.2.2 --- squid/src/cache_cf.c 6 Jan 2001 12:40:12 -0000 1.1.1.3.4.4.2.1 +++ squid/src/cache_cf.c 3 Jun 2001 19:41:47 -0000 1.1.1.3.4.4.2.2 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.c,v 1.1.1.3.4.4.2.1 2001/01/06 12:40:12 hno Exp $ + * $Id: cache_cf.c,v 1.1.1.3.4.4.2.2 2001/06/03 19:41:47 serassio Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -178,11 +178,14 @@ char *token = NULL; char *tmp_line; int err_count = 0; - free_all(); + configFreeMemory(); default_all(); if ((fp = fopen(file_name, "r")) == NULL) fatalf("Unable to open configuration file: %s: %s", file_name, xstrerror()); +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(fp), O_TEXT); +#endif cfg_filename = file_name; if ((token = strrchr(cfg_filename, '/'))) cfg_filename = token + 1; @@ -1739,6 +1742,7 @@ void configFreeMemory(void) { + safe_free(Config2.Accel.prefix); free_all(); } Index: squid/src/cache_diff.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cache_diff.c,v retrieving revision 1.1.1.1.4.1.2.1 retrieving revision 1.1.1.1.4.1.2.2 diff -u -r1.1.1.1.4.1.2.1 -r1.1.1.1.4.1.2.2 --- squid/src/cache_diff.c 6 Jan 2001 12:40:12 -0000 1.1.1.1.4.1.2.1 +++ squid/src/cache_diff.c 3 Jun 2001 19:41:48 -0000 1.1.1.1.4.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: cache_diff.c,v 1.1.1.1.4.1.2.1 2001/01/06 12:40:12 hno Exp $ + * $Id: cache_diff.c,v 1.1.1.1.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * AUTHOR: Alex Rousskov * @@ -136,6 +136,9 @@ fprintf(stderr, "cannot open %s: %s\n", fname, strerror(errno)); return 0; } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(file), O_BINARY); +#endif scanned_count = cacheIndexScan(idx, fname, file); fclose(file); Index: squid/src/carp.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/carp.c,v retrieving revision 1.1.1.1.4.4.2.1 retrieving revision 1.1.1.1.4.4.2.2 diff -u -r1.1.1.1.4.4.2.1 -r1.1.1.1.4.4.2.2 --- squid/src/carp.c 6 Jan 2001 12:40:12 -0000 1.1.1.1.4.4.2.1 +++ squid/src/carp.c 3 Jun 2001 19:41:48 -0000 1.1.1.1.4.4.2.2 @@ -1,5 +1,5 @@ /* - * $Id: carp.c,v 1.1.1.1.4.4.2.1 2001/01/06 12:40:12 hno Exp $ + * $Id: carp.c,v 1.1.1.1.4.4.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 39 Cache Array Routing Protocol * AUTHOR: Eric Stern Index: squid/src/cf.data.pre =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf.data.pre,v retrieving revision 1.1.1.3.4.3.2.1 retrieving revision 1.1.1.3.4.3.2.2 diff -u -r1.1.1.3.4.3.2.1 -r1.1.1.3.4.3.2.2 --- squid/src/cf.data.pre 6 Jan 2001 12:40:12 -0000 1.1.1.3.4.3.2.1 +++ squid/src/cf.data.pre 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.3.2.2 @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.1.1.3.4.3.2.1 2001/01/06 12:40:12 hno Exp $ +# $Id: cf.data.pre,v 1.1.1.3.4.3.2.2 2001/06/03 19:41:48 serassio Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -3235,5 +3235,27 @@ client_persistent_connections on server_persistent_connections on DOC_END + +NAME: ie_refresh +TYPE: onoff +LOC: Config.onoff.ie_refresh +DEFAULT: off +DOC_START + Microsoft Internet Explorer up until version 5.5 Service Pack 1 has + an issue with transparent proxies, wherein it is impossible to + force a refresh. Turning this on provides a partial fix to the + problem, by causing all IMS-REFRESH requests from older IE versions + to check the origin server for fresh content. This reduces hit + ratio by some amount (~10% in my experience), but allows users + to actually get fresh content when they want it. Note that because + Squid cannot tell if the user is using 5.5 or 5.5SP1, the behavior + of 5.5 is unchanged from old versions of Squid (i.e. a forced + refresh is impossible). Newer versions of IE will, hopefully, + continue to have the new behavior and will be handled based on that + assumption. This option defaults to the old Squid behavior, which + is better for hit ratios but worse for clients using IE, if they + need to be able to force fresh content. +ie_refresh off +DOC_END EOF Index: squid/src/cf_gen.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/cf_gen.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/cf_gen.c 6 Jan 2001 12:40:12 -0000 1.1.1.3.4.1.2.1 +++ squid/src/cf_gen.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,5 +1,5 @@ /* - * $Id: cf_gen.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:12 hno Exp $ + * $Id: cf_gen.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: none * AUTHOR: Max Okumoto @@ -64,6 +64,10 @@ #if HAVE_ASSERT_H #include #endif +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) +#include +#include +#endif #include "util.h" @@ -134,6 +138,9 @@ perror(input_filename); exit(1); } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(fp), O_TEXT); +#endif state = sSTART; while (feof(fp) == 0 && state != sEXIT) { char buff[MAX_LINE]; @@ -307,6 +314,9 @@ perror(output_filename); exit(1); } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(fp), O_TEXT); +#endif fprintf(fp, "/*\n" " * Generated automatically from %s by %s\n" @@ -329,6 +339,9 @@ perror(conf_filename); exit(1); } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(fp), O_TEXT); +#endif gen_conf(entries, fp); fclose(fp); Index: squid/src/client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/client.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/client.c 6 Jan 2001 12:40:12 -0000 1.1.1.3.4.1.2.1 +++ squid/src/client.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: client.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:12 hno Exp $ + * $Id: client.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -199,6 +199,9 @@ xstrerror()); exit(-1); } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(put_fd, O_BINARY); +#endif fstat(put_fd, &sb); } snprintf(msg, BUFSIZ, "%s %s HTTP/1.0\r\n", method, url); Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.1.1.3.4.6.2.1 retrieving revision 1.1.1.3.4.6.2.2 diff -u -r1.1.1.3.4.6.2.1 -r1.1.1.3.4.6.2.2 --- squid/src/client_side.c 6 Jan 2001 12:40:13 -0000 1.1.1.3.4.6.2.1 +++ squid/src/client_side.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.6.2.2 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.1.1.3.4.6.2.1 2001/01/06 12:40:13 hno Exp $ + * $Id: client_side.c,v 1.1.1.3.4.6.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -32,6 +32,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ + #define CLIENT_SIDE_C #include "squid.h" @@ -761,9 +762,7 @@ request_t *request = http->request; const HttpHeader *req_hdr = &request->header; int no_cache = 0; -#if USE_USERAGENT_LOG const char *str; -#endif request->imslen = -1; request->ims = httpHeaderGetTime(req_hdr, HDR_IF_MODIFIED_SINCE); if (request->ims > 0) @@ -778,6 +777,27 @@ if (request->cache_control) if (EBIT_TEST(request->cache_control->mask, CC_NO_CACHE)) no_cache++; + /* Work around for supporting the Reload button in IE browsers + * when Squid is used as an accelerator or transparent proxy, + * by turning accelerated IMS request to no-cache requests. + * Now knows about IE 5.5 fix (is actually only fixed in SP1, + * but we can't tell whether we are talking to SP1 or not so + * all 5.5 versions are treated 'normally'). + */ + if (Config.onoff.ie_refresh) { + if (http->flags.accel && request->flags.ims) { + if ( (str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT)) ) { + if (strstr(str, "MSIE 5.01") != NULL) + no_cache++; + else if (strstr(str, "MSIE 5.0") != NULL) + no_cache++; + else if (strstr(str, "MSIE 4.") != NULL) + no_cache++; + else if (strstr(str, "MSIE 3.") != NULL) + no_cache++; + } + } + } if (no_cache) { #if HTTP_VIOLATIONS if (Config.onoff.reload_into_ims) Index: squid/src/comm.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/comm.c 6 Jan 2001 12:40:13 -0000 1.1.1.3.4.1.2.1 +++ squid/src/comm.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: comm.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:13 hno Exp $ + * $Id: comm.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -32,6 +32,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */ + #define COMM_C #include "squid.h" @@ -223,7 +224,7 @@ #ifdef _SQUID_MSWIN_ F = &sd_table[new_socket]; #else - F = &fd_table[new_socket]; + F = &fd_table[new_socket]; #endif if (!(flags & COMM_NOCLOEXEC)) commSetCloseOnExec(new_socket); Index: squid/src/debug.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/debug.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/debug.c 6 Jan 2001 12:40:13 -0000 1.1.1.3.4.1.2.1 +++ squid/src/debug.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: debug.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:13 hno Exp $ + * $Id: debug.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -157,6 +157,9 @@ fflush(stderr); debug_log = stderr; } +#if defined(_SQUID_CYGWIN_)||defined(_SQUID_MSWIN_) + setmode(fileno(debug_log), O_TEXT); +#endif } void @@ -212,7 +215,7 @@ i--; snprintf(from, MAXPATHLEN, "%s.%d", debug_log_file, i - 1); snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, i); - rename(from, to); + xrename(from, to); } /* * You can't rename open files on Microsoft "operating systems" @@ -225,11 +228,7 @@ /* Rotate the current log to .0 */ if (Config.Log.rotateNumber > 0) { snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, 0); -#ifdef _SQUID_MSWIN_ xrename(debug_log_file, to); -#else - rename(debug_log_file, to); -#endif } /* Close and reopen the log. It may have been renamed "manually" * before HUP'ing us. */ Index: squid/src/dnsserver.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/dnsserver.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/dnsserver.c 6 Jan 2001 12:40:13 -0000 1.1.1.3.4.1.2.1 +++ squid/src/dnsserver.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: dnsserver.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:13 hno Exp $ + * $Id: dnsserver.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 0 DNS Resolver * AUTHOR: Harvest Derived @@ -191,6 +191,7 @@ DNSLookup(const char *buf, void *data, HLPCB callback) { static char reply[20*sizeof(buf)],tail[20*sizeof(buf)]; +int charcount; #else static void lookup(const char *buf) @@ -210,8 +211,8 @@ if (0 == strcmp(buf, "$hello")) { #ifdef _SQUID_MSWIN_ snprintf(reply,sizeof(reply),"$alive\n"); - (callback)(data,reply); - return 0; + (callback)(data,reply); + return 0; #else printf("$alive\n"); return; @@ -253,6 +254,7 @@ buf, my_h_msgs(h_errno)); } #ifdef _SQUID_MSWIN_ + (callback)(data,reply); return 0; #else Index: squid/src/main.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/main.c,v retrieving revision 1.1.1.3.4.2.2.2 retrieving revision 1.1.1.3.4.2.2.3 diff -u -r1.1.1.3.4.2.2.2 -r1.1.1.3.4.2.2.3 --- squid/src/main.c 25 Mar 2001 16:42:23 -0000 1.1.1.3.4.2.2.2 +++ squid/src/main.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: main.c,v 1.1.1.3.4.2.2.2 2001/03/25 16:42:23 serassio Exp $ + * $Id: main.c,v 1.1.1.3.4.2.2.3 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -1230,6 +1230,7 @@ #endif storeLogClose(); accessLogClose(); + useragentLogClose(); #if USE_ASYNC_IO aioSync(); /* flush log close */ #endif @@ -1278,7 +1279,7 @@ #ifdef SERVICE #include -VOID main(int argc, char **argv) { +int main(int argc, char **argv) { SERVICE_TABLE_ENTRY DispatchTable[] = { { SQUID_SERVICE_NAME, SquidMain }, { NULL, NULL } Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/mime.c 6 Jan 2001 12:40:14 -0000 1.1.1.3.4.1.2.1 +++ squid/src/mime.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:14 hno Exp $ + * $Id: mime.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -292,6 +292,9 @@ debug(50, 1) ("mimeInit: %s: %s\n", filename, xstrerror()); return; } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(fp), O_TEXT); +#endif if (MimeTableTail == NULL) MimeTableTail = &MimeTable; while (fgets(buf, BUFSIZ, fp)) { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.1.1.3.4.1.2.2 retrieving revision 1.1.1.3.4.1.2.3 diff -u -r1.1.1.3.4.1.2.2 -r1.1.1.3.4.1.2.3 --- squid/src/protos.h 25 Mar 2001 16:42:23 -0000 1.1.1.3.4.1.2.2 +++ squid/src/protos.h 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.1.1.3.4.1.2.2 2001/03/25 16:42:23 serassio Exp $ + * $Id: protos.h,v 1.1.1.3.4.1.2.3 2001/06/03 19:41:48 serassio Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1075,6 +1075,7 @@ extern void useragentOpenLog(void); extern void useragentRotateLog(void); extern void logUserAgent(const char *, const char *); +extern void useragentLogClose(void); extern peer_t parseNeighborType(const char *s); extern void errorInitialize(void); Index: squid/src/squid.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/squid.h,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/squid.h 6 Jan 2001 12:40:16 -0000 1.1.1.3.4.1.2.1 +++ squid/src/squid.h 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:16 hno Exp $ + * $Id: squid.h,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * AUTHOR: Duane Wessels * @@ -189,6 +189,9 @@ #if HAVE_LIMITS_H #include #endif +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) +#include +#endif #if HAVE_DIRENT_H #include @@ -433,6 +436,7 @@ #define SWAP_FILE_MASK 0x00FFFFFF #ifdef _SQUID_MSWIN_ +/* Some tricks for MS Compilers */ #define SQUID_SERVICE_CONTROL_ROTATE 128 #define SQUID_SERVICE_CONTROL_RECONFIGURE 129 #define SQUID_SERVICE_CONTROL_DEBUG 130 Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/stat.c 6 Jan 2001 12:40:16 -0000 1.1.1.3.4.1.2.1 +++ squid/src/stat.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:16 hno Exp $ + * $Id: stat.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -961,6 +961,7 @@ statHistClean(&C->dns.svc_time); statHistClean(&C->cd.on_xition_count); statHistClean(&C->comm_icp_incoming); + statHistClean(&C->comm_dns_incoming); statHistClean(&C->comm_http_incoming); statHistClean(&C->select_fds_hist); } Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.1.1.3.4.5.2.1 retrieving revision 1.1.1.3.4.5.2.2 diff -u -r1.1.1.3.4.5.2.1 -r1.1.1.3.4.5.2.2 --- squid/src/store.c 6 Jan 2001 12:40:16 -0000 1.1.1.3.4.5.2.1 +++ squid/src/store.c 3 Jun 2001 19:41:48 -0000 1.1.1.3.4.5.2.2 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.1.1.3.4.5.2.1 2001/01/06 12:40:16 hno Exp $ + * $Id: store.c,v 1.1.1.3.4.5.2.2 2001/06/03 19:41:48 serassio Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -1290,11 +1290,13 @@ if (served_date < 0 || served_date > squid_curtime) served_date = squid_curtime; /* - * Compensate with Age header if origin server clock is ahead of us - * and there is a cache in between us and the origin server - */ + * Compensate with Age header if origin server clock is ahead + * of us and there is a cache in between us and the origin + * server. But DONT compensate if the age value is larger than + * squid_curtime because it results in a negative served_date. */ if (age > squid_curtime - served_date) - served_date = squid_curtime - age; + if (squid_curtime > age) + served_date = squid_curtime - age; entry->expires = reply->expires; entry->lastmod = reply->last_modified; entry->timestamp = served_date; Index: squid/src/store_dir.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_dir.c,v retrieving revision 1.1.1.3.4.2.2.1 retrieving revision 1.1.1.3.4.2.2.2 diff -u -r1.1.1.3.4.2.2.1 -r1.1.1.3.4.2.2.2 --- squid/src/store_dir.c 6 Jan 2001 12:40:16 -0000 1.1.1.3.4.2.2.1 +++ squid/src/store_dir.c 3 Jun 2001 19:41:49 -0000 1.1.1.3.4.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: store_dir.c,v 1.1.1.3.4.2.2.1 2001/01/06 12:40:16 hno Exp $ + * $Id: store_dir.c,v 1.1.1.3.4.2.2.2 2001/06/03 19:41:49 serassio Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -348,8 +348,9 @@ SwapDir *sd; for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { sd = &Config.cacheSwap.swapDirs[dirn]; - sd->log.open(sd); - } + if (sd->log.open) + sd->log.open(sd); + } } void @@ -359,7 +360,8 @@ SwapDir *sd; for (dirn = 0; dirn < Config.cacheSwap.n_configured; dirn++) { sd = &Config.cacheSwap.swapDirs[dirn]; - sd->log.close(sd); + if (sd->log.close) + sd->log.close(sd); } } Index: squid/src/store_dir_ufs.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/store_dir_ufs.c,v retrieving revision 1.1.1.1.4.1.2.1 retrieving revision 1.1.1.1.4.1.2.2 diff -u -r1.1.1.1.4.1.2.1 -r1.1.1.1.4.1.2.2 --- squid/src/store_dir_ufs.c 6 Jan 2001 12:40:16 -0000 1.1.1.1.4.1.2.1 +++ squid/src/store_dir_ufs.c 3 Jun 2001 19:41:49 -0000 1.1.1.1.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.c,v 1.1.1.1.4.1.2.1 2001/01/06 12:40:16 hno Exp $ + * $Id: store_dir_ufs.c,v 1.1.1.1.4.1.2.2 2001/06/03 19:41:49 serassio Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -741,13 +741,7 @@ char *new_path = xstrdup(storeUfsDirSwapLogFile(sd, ".new")); int fd; file_close(sd->u.ufs.swaplog_fd); -#ifdef _SQUID_OS2_ - if (unlink(swaplog_path) < 0) { - debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); - fatal("storeUfsDirCloseTmpSwapLog: unlink failed"); - } -#endif -#ifdef _SQUID_MSWIN_ +#if defined (_SQUID_OS2_) || defined (_SQUID_CYGWIN_) || defined(_SQUID_MSWIN_) if (unlink(swaplog_path) < 0) { debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); fatal("storeUfsDirCloseTmpSwapLog: unlink failed"); @@ -796,15 +790,14 @@ } sd->u.ufs.swaplog_fd = fd; /* open a read-only stream of the old log */ -#ifdef _SQUID_MSWIN_ - fp = fopen(swaplog_path, "rb"); -#else - fp = fopen(swaplog_path, "r"); -#endif if (fp == NULL) { debug(50, 0) ("%s: %s\n", swaplog_path, xstrerror()); fatal("Failed to open swap log for reading"); } +#if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_) + setmode(fileno(fp), O_BINARY); +#endif + memset(&clean_sb, '\0', sizeof(struct stat)); if (stat(clean_path, &clean_sb) < 0) *clean_flag = 0; @@ -937,14 +930,7 @@ storeUfsDirCloseSwapLog(sd); /* rename */ if (state->fd >= 0) { -#ifdef _SQUID_OS2_ - file_close(state->fd); - state->fd = -1; - if (unlink(cur) < 0) - debug(50, 0) ("storeDirWriteCleanLogs: unlinkd failed: %s, %s\n", - xstrerror(), cur); -#endif -#ifdef _SQUID_MSWIN_ +#if defined(_SQUID_OS2_) || defined (_SQUID_CYGWIN_) || defined (_SQUID_MSWIN_) file_close(state->fd); state->fd = -1; if (unlink(state->cur) < 0) Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.1.1.3.4.2.2.1 retrieving revision 1.1.1.3.4.2.2.2 diff -u -r1.1.1.3.4.2.2.1 -r1.1.1.3.4.2.2.2 --- squid/src/structs.h 6 Jan 2001 12:40:16 -0000 1.1.1.3.4.2.2.1 +++ squid/src/structs.h 3 Jun 2001 19:41:49 -0000 1.1.1.3.4.2.2.2 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.1.1.3.4.2.2.1 2001/01/06 12:40:16 hno Exp $ + * $Id: structs.h,v 1.1.1.3.4.2.2.2 2001/06/03 19:41:49 serassio Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -417,6 +417,7 @@ #if USE_CACHE_DIGESTS int digest_generation; #endif + int ie_refresh; } onoff; acl *aclList; struct { Index: squid/src/tools.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/tools.c,v retrieving revision 1.1.1.3.4.1.2.2 retrieving revision 1.1.1.3.4.1.2.3 diff -u -r1.1.1.3.4.1.2.2 -r1.1.1.3.4.1.2.3 --- squid/src/tools.c 25 Mar 2001 16:42:23 -0000 1.1.1.3.4.1.2.2 +++ squid/src/tools.c 3 Jun 2001 19:41:49 -0000 1.1.1.3.4.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: tools.c,v 1.1.1.3.4.1.2.2 2001/03/25 16:42:23 serassio Exp $ + * $Id: tools.c,v 1.1.1.3.4.1.2.3 2001/06/03 19:41:49 serassio Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -187,7 +187,7 @@ PROCESS_VM_READ, FALSE, GetCurrentProcessId() ); - if ( GetProcessTimes( hProcess, &ftCreate, &ftExit, &ftKernel, &ftUser)); + if ( GetProcessTimes( hProcess, &ftCreate, &ftExit, &ftKernel, &ftUser)) { LONGLONG tUser64 = *(LONGLONG *)&ftUser; LONGLONG tKernel64 = *(LONGLONG *)&ftKernel; Index: squid/src/typedefs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/typedefs.h,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/typedefs.h 6 Jan 2001 12:40:17 -0000 1.1.1.3.4.1.2.1 +++ squid/src/typedefs.h 3 Jun 2001 19:41:49 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: typedefs.h,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:17 hno Exp $ + * $Id: typedefs.h,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:49 serassio Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -35,7 +35,7 @@ typedef unsigned int mem_status_t; typedef unsigned int ping_status_t; typedef unsigned int swap_status_t; -typedef int sfileno; +typedef signed int sfileno; typedef struct { size_t bytes; Index: squid/src/useragent.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/useragent.c,v retrieving revision 1.1.1.3.4.1.2.1 retrieving revision 1.1.1.3.4.1.2.2 diff -u -r1.1.1.3.4.1.2.1 -r1.1.1.3.4.1.2.2 --- squid/src/useragent.c 6 Jan 2001 12:40:17 -0000 1.1.1.3.4.1.2.1 +++ squid/src/useragent.c 3 Jun 2001 19:41:49 -0000 1.1.1.3.4.1.2.2 @@ -1,6 +1,6 @@ /* - * $Id: useragent.c,v 1.1.1.3.4.1.2.1 2001/01/06 12:40:17 hno Exp $ + * $Id: useragent.c,v 1.1.1.3.4.1.2.2 2001/06/03 19:41:49 serassio Exp $ * * DEBUG: section 40 User-Agent logging * AUTHOR: Joe Ramey @@ -60,6 +60,10 @@ } if (log_fd < 0 || cache_useragent_log == NULL) debug(40, 1) ("User-Agent logging is disabled.\n"); +#if defined(_SQUID_CYGWIN_)||defined(_SQUID_MSWIN_) + setmode(fileno(cache_useragent_log), O_TEXT); +#endif + #endif } @@ -117,11 +121,7 @@ strcpy(time_str, s); last_time = squid_curtime; } -#ifdef _SQUID_MSWIN_ - fprintf(cache_useragent_log, "%s [%s] \"%s\"\r\n", -#else fprintf(cache_useragent_log, "%s [%s] \"%s\"\n", -#endif client, time_str, agent); @@ -129,3 +129,13 @@ fflush(cache_useragent_log); #endif } + +void +useragentLogClose(void) +{ +#if USE_USERAGENT_LOG + if (cache_useragent_log) + fclose(cache_useragent_log); + cache_useragent_log = NULL; +#endif +}