--- loncom/lonnet/perl/lonnet.pm 2005/03/10 19:10:30 1.606 +++ loncom/lonnet/perl/lonnet.pm 2005/03/16 21:35:17 1.607 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.606 2005/03/10 19:10:30 matthew Exp $ +# $Id: lonnet.pm,v 1.607 2005/03/16 21:35:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -994,27 +994,27 @@ sub subscribe { sub repcopy { my $filename=shift; $filename=~s/\/+/\//g; - if ($filename=~m|^/home/httpd/html/adm/|) { return 'OK'; } - if ($filename=~m|^/home/httpd/html/lonUsers/|) { return 'OK'; } + if ($filename=~m|^/home/httpd/html/adm/|) { return 'ok'; } + if ($filename=~m|^/home/httpd/html/lonUsers/|) { return 'ok'; } if ($filename=~m|^/home/httpd/html/userfiles/| or $filename=~m|^/*uploaded/|) { return &repcopy_userfile($filename); } $filename=~s/[\n\r]//g; my $transname="$filename.in.transfer"; - if ((-e $filename) || (-e $transname)) { return 'OK'; } + if ((-e $filename) || (-e $transname)) { return 'ok'; } my $remoteurl=subscribe($filename); if ($remoteurl =~ /^con_lost by/) { &logthis("Subscribe returned $remoteurl: $filename"); - return 'HTTP_SERVICE_UNAVAILABLE'; + return 'unavailable'; } elsif ($remoteurl eq 'not_found') { #&logthis("Subscribe returned not_found: $filename"); - return 'HTTP_NOT_FOUND'; + return 'not_found'; } elsif ($remoteurl =~ /^rejected by/) { &logthis("Subscribe returned $remoteurl: $filename"); - return 'FORBIDDEN'; + return 'forbidden'; } elsif ($remoteurl eq 'directory') { - return 'OK'; + return 'ok'; } else { my $author=$filename; $author=~s/\/home\/httpd\/html\/res\/([^\/]*)\/([^\/]*).*/$1\/$2/; @@ -1025,7 +1025,7 @@ sub repcopy { my $path="/$parts[1]/$parts[2]/$parts[3]/$parts[4]"; if ($path ne "$perlvar{'lonDocRoot'}/res") { &logthis("Malconfiguration for replication: $filename"); - return 'HTTP_BAD_REQUEST'; + return 'bad_request'; } my $count; for ($count=5;$count<$#parts;$count++) { @@ -1042,7 +1042,7 @@ sub repcopy { my $message=$response->status_line; &logthis("WARNING:" ." LWP get: $message: $filename"); - return 'HTTP_SERVICE_UNAVAILABLE'; + return 'unavailable'; } else { if ($remoteurl!~/\.meta$/) { my $mrequest=new HTTP::Request('GET',$remoteurl.'.meta'); @@ -1054,7 +1054,7 @@ sub repcopy { } } rename($transname,$filename); - return 'OK'; + return 'ok'; } } } @@ -5259,7 +5259,7 @@ sub getfile { sub repcopy_userfile { my ($file)=@_; if ($file =~ m|^/*uploaded/|) { $file=&filelocation("",$file); } - if ($file =~ m|^/home/httpd/html/lonUsers/|) { return 'OK'; } + if ($file =~ m|^/home/httpd/html/lonUsers/|) { return 'ok'; } my ($cdom,$cnum,$filename) = ($file=~m|^\Q$perlvar{'lonDocRoot'}\E/+userfiles/+([^/]+)/+([^/]+)/+(.*)|); my ($info,$rtncode); @@ -5282,7 +5282,7 @@ sub repcopy_userfile { return -1; } if ($info < $fileinfo[9]) { - return 'OK'; + return 'ok'; } $info = ''; $lwpresp = &getuploaded('GET',$uri,$cdom,$cnum,\$info,\$rtncode); @@ -5316,7 +5316,7 @@ sub repcopy_userfile { open(FILE,">$file"); print FILE $info; close(FILE); - return 'OK'; + return 'ok'; } sub tokenwrapper { @@ -6133,8 +6133,8 @@ subscribe($fname) : subscribe to a resou repcopy($filename) : subscribes to the requested file, and attempts to replicate from the owning library server, Might return -'HTTP_SERVICE_UNAVAILABLE', 'HTTP_NOT_FOUND', 'FORBIDDEN', 'OK', or -'HTTP_BAD_REQUEST', also attempts to grab the metadata for the +'unavailable', 'not_found', 'forbidden', 'ok', or +'bad_request', also attempts to grab the metadata for the resource. Expects the local filesystem pathname (/home/httpd/html/res/....)