3 # Save miscellaneous options
5 require './squid-lib.pl';
6 $access{'miscopt'} || &error($text{'emisc_ecannot'});
8 &lock_file($config{'squid_conf'});
10 $whatfailed = $text{'smisc_ftso'};
12 &save_opt("dns_testnames", undef, $conf);
13 &save_opt("logfile_rotate", \&check_rotate, $conf);
14 &save_opt("append_domain", \&check_domain, $conf);
15 if ($squid_version < 2) {
16 &save_opt("ssl_proxy", \&check_proxy, $conf);
17 &save_opt("passthrough_proxy", \&check_proxy, $conf);
19 &save_opt("err_html_text", undef, $conf);
20 &save_choice("client_db", "on", $conf);
21 &save_choice("forwarded_for", "on", $conf);
22 &save_choice("log_icp_queries", "on", $conf);
23 &save_opt("minimum_direct_hops", \&check_hops, $conf);
24 if ($squid_version >= 2.2 && $squid_version < 2.5) {
25 $m = $in{'anon_mode'};
27 &save_directive($conf, "anonymize_headers", [ ]);
30 &save_directive($conf, "anonymize_headers",
31 [ { 'name' => 'anonymize_headers',
32 'values' => [ $m==1 ? "allow" : "deny",
33 $m==1 ? $in{'anon_allow'}
34 : $in{'anon_deny'} ] } ]);
37 elsif ($squid_version < 2.2) {
38 &save_choice("http_anonymizer", "off", $conf);
40 &save_opt("fake_user_agent", undef, $conf);
41 &save_choice("memory_pools", "on", $conf);
42 if ($squid_version < 2.6) {
43 if ($in{'accel'} == 0) {
44 &save_directive($conf, "httpd_accel_host", [ ]);
47 local $v = $in{'accel'} == 1 ? "virtual" : $in{"httpd_accel_host"};
48 &save_directive($conf, "httpd_accel_host",
49 [ { 'name' => "httpd_accel_host", 'values' => [$v] } ]);
51 &save_opt("httpd_accel_port", undef, $conf);
52 &save_choice("httpd_accel_with_proxy", undef, $conf);
53 &save_choice("httpd_accel_uses_host_header", undef, $conf);
54 if ($squid_version >= 2.5) {
55 &save_choice("httpd_accel_single_host", undef, $conf);
58 if ($squid_version >= 2) {
59 &save_opt_bytes("memory_pools_limit", $conf);
61 if ($squid_version >= 2.3) {
62 &save_opt("wccp_router", undef, $conf);
63 &save_opt("wccp_incoming_address", undef, $conf);
64 &save_opt("wccp_outgoing_address", undef, $conf);
67 &unlock_file($config{'squid_conf'});
68 &webmin_log("misc", undef, undef, \%in);
73 return $_[0] =~ /^\d+$/ ? undef : &text('smisc_emsg1',$_[0]);
78 return $_[0] =~ /^[A-z0-9\.\-]+$/ ? undef : &text('smisc_emsg2',$_[0]);
83 return $_[0] =~ /^\S+$/ ? undef : &text('smisc_emsg3',$_[0]);
88 return $_[0] =~ /^\d+$/ ? undef : &text('smisc_emsg4',$_[0]);