From: wessels <> Date: Mon, 16 Sep 1996 23:07:49 +0000 (+0000) Subject: From: Neil Murray X-Git-Tag: SQUID_3_0_PRE1~5787 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd9e911fbd3f596da7cf0148b9ea90de4c054ea9;p=thirdparty%2Fsquid.git From: Neil Murray I was doing some testing and found a case I hadn't allowed for in my cachemgr.c mods. Where you have a "?" 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 ":" 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. --- diff --git a/src/cachemgr.cc b/src/cachemgr.cc index 7a6f3c7b03..5ec91206ef 100644 --- a/src/cachemgr.cc +++ b/src/cachemgr.cc @@ -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); }