[rrd-developers] rrdcgi and Apache 2.0 (cgi args count diff)

Krzysztof Ceglinski Krzysztof_Ceglinski at idg.com.pl
Thu Oct 24 00:50:56 MEST 2002


Hello RRD-Developers :)

Hmm rrdcgi seems to have some kind of bug ;) - it can't work properly with
apache 2.0 if we have values in query string. 
Basically we have 'raw' query string added to value arguments list =
comparing to Apache 1.3.X we have +1 arg if we have query string....

Below is attached unified patch which solves problem for me :)
If You thing that's useful please include in CVS (apache 2.0 seems to be
more and more popular ;) )...

--- rrd_cgi.c.orig      Fri Oct 11 20:39:46 2002
+++ rrd_cgi.c   Thu Oct 24 00:41:34 2002
@@ -128,9 +128,17 @@
       server_url = getenv("SERVER_URL");
   }

-  if (optind != argc-1) {
-     fprintf(stderr, "ERROR: expected a filename\n");
-     exit(1);
+/* Apache 2.0 mod - Apache 2.0 sends more variables if we have query string
+it's adding raw query string as last argument so we may have two situations
+when there is no Query String optind=argc-1 (like in Apache 1.3.X) but if
we have
+Query string optind=argc-2
+
+It works for me with Apache 4.0.23 - krzysztof_ceglinski at idg.com.pl
+*/
+
+  if ( (optind != argc-2 && strstr(getenv("SERVER_SOFTWARE"),"Apache/2") !=
NULL) && optind != argc-1) {
+    fprintf(stderr, "ERROR: expected a filename\n");
+    exit(1);
   } else {
      length  = readfile(argv[optind], &buffer, 1);
   }

best regards,
-- 
Krzysztof Ceglinski


--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-developers mailing list