Package: queuegraph
Version: 1.1.1-3
Severity: wishlist
Tags: patch

Without this patch the queuepath CGI only understands arguments
directly added to the request path and expects the web server to
work accordingly.  This may not be the case all the time.

This patch adds support for QUERY_PATH so that the system still
works.  This permits the use of URLs of the form
queuegraph.cgi?/image.png as well.

Before the images were included with path components like:
  /cgi-bin/queuegraph.cgi/queuegraph_0.png

With this patch a second way exists as well:
  /cgi-bin/queuegraph.cgi?/queuegraph_0.png

It would be nice if this could be applied to the Debian package and
also fed upstream.

Regards,

        Joey

-- 
Unix is user friendly ...  It's just picky about its friends.

Please always Cc to me when replying to me on the lists.
--- /usr/lib/cgi-bin/queuegraph.cgi	2006-11-17 13:58:39.000000000 +0100
+++ queuegraph.cgi.new	2007-09-10 12:01:33.000000000 +0200
@@ -128,19 +128,20 @@ sub send_image($)
 
 sub main()
 {
-	if($ENV{PATH_INFO}) {
+	if($ENV{PATH_INFO} || $ENV{QUERY_STRING}) {
+		my $path = $ENV{PATH_INFO} ? $ENV{PATH_INFO} : $ENV{QUERY_STRING};
 		my $uri = $ENV{REQUEST_URI};
 		$uri =~ s/\/[^\/]+$//;
 		$uri =~ s/\//,/g;
 		$uri =~ s/\~/tilde,/g;
 		mkdir $tmp_dir, 0777 unless -d $tmp_dir;
 		mkdir "$tmp_dir/$uri", 0777 unless -d "$tmp_dir/$uri";
-		my $file = "$tmp_dir/$uri$ENV{PATH_INFO}";
-		if($ENV{PATH_INFO} =~ /^\/queuegraph_(\d+)\.png$/) {
+		my $file = "$tmp_dir/$uri$path";
+		if($path =~ /^\/queuegraph_(\d+)\.png$/) {
 			graph($graphs[$1]{seconds}, $file, $graphs[$1]{title});
 		}
 		else {
-			print "Content-Type: text/plain\n\nERROR: unknown image $ENV{PATH_INFO}\n";
+			print "Content-Type: text/plain\n\nERROR: unknown image $path\n";
 			exit 1;
 		}
 		send_image($file);

Reply via email to