version 1.1, 2007/03/28 00:12:59
|
version 1.4, 2017/11/30 14:33:35
|
Line 36 use Apache::lonnet;
|
Line 36 use Apache::lonnet;
|
|
|
sub serve_file { |
sub serve_file { |
my ($r,$file,$type)=@_; |
my ($r,$file,$type)=@_; |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/$file"); |
if (open(my $config,"<","$Apache::lonnet::perlvar{'lonTabDir'}/$file")) { |
my $file = join('',<$config>); |
my $contents = join('',<$config>); |
$r->content_type($type); |
$r->content_type($type); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
$r->print($file); |
$r->print($contents); |
return OK; |
return OK; |
|
} else { |
|
return FORBIDDEN; |
|
} |
} |
} |
|
|
sub handler { |
sub handler { |
Line 53 sub handler {
|
Line 56 sub handler {
|
return &serve_file($r,'dns_hosts.tab','loncapa/hosts'); |
return &serve_file($r,'dns_hosts.tab','loncapa/hosts'); |
} elsif ($command eq 'domain') { |
} elsif ($command eq 'domain') { |
return &serve_file($r,'dns_domain.tab','loncapa/domain'); |
return &serve_file($r,'dns_domain.tab','loncapa/domain'); |
|
} elsif ($command eq 'checksums') { |
|
my $version = (split('/',$r->uri))[4]; |
|
return &serve_file($r,"dns_checksums/$version.tab",'loncapa/versions'); |
} |
} |
return FORBIDDEN; |
return FORBIDDEN; |
} |
} |