Handle hostnames with upper-case letters
[webmin.git] / squid / http_reply_access_save.cgi
1 #!/usr/local/bin/perl
2 # http_reply_access_save.cgi
3 # Save or delete a proxy REPLY restriction
4
5 require './squid-lib.pl';
6 $access{'actrl'} || &error($text{'eacl_ecannot'});
7 &ReadParse();
8 &lock_file($config{'squid_conf'});
9 $conf = &get_config();
10 $whatfailed = $text{'sahttp_replyftspr'};
11
12 @http_replies = &find_config("http_reply_access", $conf);
13 if (defined($in{'index'})) {
14         $http = $conf->[$in{'index'}];
15         }
16 if ($in{'delete'}) {
17         # delete this restriction
18         splice(@http_replies, &indexof($http, @http_replies), 1);
19         }
20 else {
21         # update or create
22         @vals = ( $in{'action'} );
23         foreach $y (split(/\0/, $in{'yes'})) { push(@vals, $y); }
24         foreach $n (split(/\0/, $in{'no'})) { push(@vals, "!$n"); }
25         $newhttp = { 'name' => 'http_reply_access', 'values' => \@vals };
26         if ($http) { splice(@http_replies, &indexof($http, @http_replies), 1, $newhttp); }
27         else { push(@http_replies, $newhttp); }
28         }
29 &save_directive($conf, "http_reply_access", \@http_replies);
30 &flush_file_lines();
31 &unlock_file($config{'squid_conf'});
32 &webmin_log($in{'delete'} ? 'delete' : $http ? 'modify' : 'create', "http");
33 &redirect("edit_acl.cgi?mode=reply");
34