[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf lontrans.pm /auth lontokacc.pm lonuploadedacc.pm
www
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Aug 2002 14:45:04 -0000
www Fri Aug 2 10:45:04 2002 EDT
Added files:
/loncom lontrans.pm
/loncom/auth lonuploadedacc.pm
Modified files:
/loncom loncapa_apache.conf
/loncom/auth lontokacc.pm
Log:
Towards inter-server document transfer
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.11 loncom/loncapa_apache.conf:1.12
--- loncom/loncapa_apache.conf:1.11 Wed Jul 31 11:23:55 2002
+++ loncom/loncapa_apache.conf Fri Aug 2 10:45:04 2002
@@ -1,7 +1,7 @@
##
## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
##
-## $Id: loncapa_apache.conf,v 1.11 2002/07/31 15:23:55 www Exp $
+## $Id: loncapa_apache.conf,v 1.12 2002/08/02 14:45:04 www Exp $
##
## 1/11/2002 - Scott Harrison
## 2/19/2002 - Scott Harrison
@@ -43,6 +43,8 @@
# ------------------------------------------------------------- Access Handlers
+PerlTransHandler Apache::lontrans
+
<LocationMatch "^/res.*">
PerlAccessHandler Apache::lonacc
PerlHeaderParserHandler Apache::lonrep
@@ -54,6 +56,12 @@
<LocationMatch "^/userfiles.*">
PerlAccessHandler Apache::lontokacc
+ErrorDocument 404 /adm/notfound.html
+ErrorDocument 500 /adm/errorhandler
+</LocationMatch>
+
+<LocationMatch "/^uploaded.*">
+PerlAccessHandler Apache::lonuploadedacc
ErrorDocument 404 /adm/notfound.html
ErrorDocument 500 /adm/errorhandler
</LocationMatch>
Index: loncom/auth/lontokacc.pm
diff -u loncom/auth/lontokacc.pm:1.4 loncom/auth/lontokacc.pm:1.5
--- loncom/auth/lontokacc.pm:1.4 Thu Aug 1 18:36:11 2002
+++ loncom/auth/lontokacc.pm Fri Aug 2 10:45:04 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Access Handler for User File Transfers
#
-# $Id: lontokacc.pm,v 1.4 2002/08/01 22:36:11 www Exp $
+# $Id: lontokacc.pm,v 1.5 2002/08/02 14:45:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,7 +37,7 @@
my $r = shift;
my $reqhost;
unless ($reqhost=$r->get_remote_host(REMOTE_DOUBLE_REV)) {
- $r->log_reason("Spoof request");
+ $r->log_reason("Spoof request ".$reqhost);
return FORBIDDEN;
}
my $readline;
@@ -50,7 +50,10 @@
}
while ($readline=<$fh>) {
my ($id,$domain,$role,$name,$ip)=split(/:/,$readline);
- if ($name =~ /$reqhost/i) { return OK; }
+ if ($name =~ /$reqhost/i) {
+ $r->register_cleanup(\&removefile);
+ return OK;
+ }
}
}
@@ -59,6 +62,14 @@
return FORBIDDEN;
}
+sub removefile {
+ my $r=shift;
+ if ($r->status==HTTP_OK) {
+ &Apache::lonnet::logthis('Unlinking '.$r->filename);
+ } else {
+ &Apache::lonnet::logthis("Failed to transfer ".$r->filename);
+ }
+}
1;
__END__
Index: loncom/lontrans.pm
+++ loncom/lontrans.pm
# The LearningOnline Network
# URL translation for User Files
#
# $Id: lontrans.pm,v 1.1 2002/08/02 14:45:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
package Apache::lontrans;
use strict;
use Apache::Constants qw(:common :remotehost);
use Apache::lonnet();
use Apache::File();
sub handler {
my $r = shift;
return DECLINED;
}
1;
__END__
Index: loncom/auth/lonuploadedacc.pm
+++ loncom/auth/lonuploadedacc.pm
# The LearningOnline Network
# Access Handler for User Files
#
# $Id: lonuploadedacc.pm,v 1.1 2002/08/02 14:45:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
package Apache::lonuploadedacc;
use strict;
use Apache::Constants qw(:common :remotehost);
use Apache::lonnet();
use Apache::File();
sub handler {
my $r = shift;
return OK;
}
1;
__END__