]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Neil Murray <neil@aone.com.au>
authorwessels <>
Mon, 16 Sep 1996 23:07:49 +0000 (23:07 +0000)
committerwessels <>
Mon, 16 Sep 1996 23:07:49 +0000 (23:07 +0000)
I was doing some testing and found a case I hadn't allowed for in my
cachemgr.c mods.

Where you have a "?<proxy host>" without the ":" the code will play
up.  The change is below and in case it is easier for you the entire
patch is below that.  Assuming a virgin cachemgr.c from alpha 18 or
beta 1.

This also gives you the behaviour if that no ":<port>" is part of the
QUERY_STRING then it defaults back to the compiled port number, which
is what I think most users would expect.  I could have made it so that
a "?:" defaults back to the compiled proxy hostname but decided that
this way "?:" will wipe any compiled hostname defaults and you are
presented with a blank set of dialog boxes.

src/cachemgr.cc

index 7a6f3c7b03d1a247b3a28bb5e434e95f90dd42be..5ec91206ef4b3f2c2aa03157d4149881d7a2e5ce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cachemgr.cc,v 1.23 1996/09/15 08:05:09 wessels Exp $
+ * $Id: cachemgr.cc,v 1.24 1996/09/16 17:07:49 wessels Exp $
  *
  * DEBUG: Section 0     CGI Cache Manager
  * AUTHOR: Harvest Derived
@@ -546,15 +546,19 @@ main(int argc, char *argv[])
 
     if ((qs = getenv("QUERY_STRING")) != NULL) {
        s = strchr(qs, ':');    /* A colon separates the port from the host */
-       if (!s)
+       if (s != NULL)
+           query_port = atoi(s + 1);   /* port */
+       else {
+           query_port = CACHE_HTTP_PORT;       /* Assume the default */
            s = qs + strlen(qs);
+       }
        strncpy(query_host, qs, (s - qs));      /* host */
        query_host[s - qs] = '\0';
-       query_port = atoi(s + 1);       /* port */
-    } else {
+    } else {                   /* Use the defaults */
        strcpy(query_host, CACHEMGR_HOSTNAME);
        query_port = CACHE_HTTP_PORT;
     }
+
     if ((s = getenv("SCRIPT_NAME")) != NULL) {
        script_name = strdup(s);
     }