[LON-CAPA-cvs] cvs: loncom /lonnet/perl londns.pm
raeburn
raeburn at source.lon-capa.org
Thu Nov 30 09:33:36 EST 2017
raeburn Thu Nov 30 14:33:36 2017 EDT
Modified files:
/loncom/lonnet/perl londns.pm
Log:
- Use three-argument open() to separate file mode from the filename.
Index: loncom/lonnet/perl/londns.pm
diff -u loncom/lonnet/perl/londns.pm:1.3 loncom/lonnet/perl/londns.pm:1.4
--- loncom/lonnet/perl/londns.pm:1.3 Mon Sep 2 14:40:18 2013
+++ loncom/lonnet/perl/londns.pm Thu Nov 30 14:33:35 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# A debugging harness.
#
-# $Id: londns.pm,v 1.3 2013/09/02 14:40:18 raeburn Exp $
+# $Id: londns.pm,v 1.4 2017/11/30 14:33:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -36,13 +36,16 @@
sub serve_file {
my ($r,$file,$type)=@_;
- open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/$file");
- my $file = join('',<$config>);
- $r->content_type($type);
- $r->send_http_header;
- return OK if $r->header_only;
- $r->print($file);
- return OK;
+ if (open(my $config,"<","$Apache::lonnet::perlvar{'lonTabDir'}/$file")) {
+ my $contents = join('',<$config>);
+ $r->content_type($type);
+ $r->send_http_header;
+ return OK if $r->header_only;
+ $r->print($contents);
+ return OK;
+ } else {
+ return FORBIDDEN;
+ }
}
sub handler {
More information about the LON-CAPA-cvs
mailing list