save_ports.cgi

来自「Unix下基于Web的管理工具」· CGI 代码 · 共 42 行

CGI
42
字号
#!/usr/local/bin/perl# save_ports.cgi# Save ports and other networking optionsrequire './squid-lib.pl';&ReadParse();$conf = &get_config();$whatfailed = "Failed to save port options";&save_opt("http_port", \&check_port, $conf);&save_opt("icp_port", \&check_port, $conf);&save_opt("tcp_outgoing_address", \&check_address, $conf);&save_opt("tcp_incoming_address", \&check_address, $conf);&save_opt("udp_outgoing_address", \&check_address, $conf);&save_opt("udp_incoming_address", \&check_address, $conf);if (!$in{'udp_outgoing_address_def'} && !$in{'udp_incoming_address_def'} &&     $in{'udp_outgoing_address'} eq $in{'udp_incoming_address'}) {	&error("The outgoing and incoming UDP addresses cannot be the same");	}&save_address("mcast_groups", $conf);&save_opt("tcp_recv_bufsize", \&check_bufsize, $conf);&flush_file_lines();&redirect("");sub check_port{return $_[0] =~ /^\d+$/ ? undef : "'$_[0]' is not a valid port number";}sub check_address{return &check_ipaddress($_[0]) || gethostbyname($_[0]) ? undef :	"'$_[0]' is not a valid address";}sub check_bufsize{return $_[0] =~ /^\d+$/ ? undef : "'$_[0]' is not a valid buffer size";}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?