Handle hostnames with upper-case letters
[webmin.git] / squid / cachemgr.cgi
1 #!/usr/local/bin/perl
2 # cachemgr.cgi
3 # Run the squid cachemgr.cgi program
4
5 require './squid-lib.pl';
6 $access{'cms'} || &error($text{'cach_ecannot'});
7 ($mgr) = glob($config{'cachemgr_path'});
8 &same_file($0, $mgr) && &error($text{'cach_esame'});
9 if (&has_command($mgr)) {
10         $| = 1;
11         if ($ENV{'REQUEST_METHOD'} eq 'POST') {
12                 # Deal with POST data
13                 &read_fully(STDIN, \$post, $ENV{'CONTENT_LENGTH'});
14                 $temp = &transname();
15                 open(TEMP, ">$temp");
16                 print TEMP $post;
17                 close(TEMP);
18                 open(MGR, "$mgr ".join(" ", @ARGV)." <$temp |");
19                 }
20         else {
21                 open(MGR, "$mgr ".join(" ", @ARGV)." |");
22                 }
23         while(<MGR>) {
24                 print;
25                 }
26         close(MGR);
27         unlink($temp) if ($temp);
28         }
29 else {
30         &ui_print_header(undef, $text{'cach_err'}, "");
31         print &text('cach_nfound',$mgr,$module_name);
32         print "\n<p>\n";
33         }
34 &ui_print_footer("", $text{'cach_return'});
35