Diff for /loncom/homework/daxeopen.pm between versions 1.1 and 1.2

version 1.1, 2015/12/03 20:40:27 version 1.2, 2015/12/10 16:26:43
Line 53  sub handler { Line 53  sub handler {
         return convert_problem($uri, $request);          return convert_problem($uri, $request);
     } else {      } else {
         # Apache should send other files directly          # Apache should send other files directly
         return HTTP_NOT_ACCEPTABLE;          $request->status(406);
           return OK;
     }      }
 }  }
   
Line 63  sub convert_problem { Line 64  sub convert_problem {
     my $file = &Apache::lonnet::filelocation('', $uri);      my $file = &Apache::lonnet::filelocation('', $uri);
     &Apache::lonnet::repcopy($file);      &Apache::lonnet::repcopy($file);
     if (! -e $file) {      if (! -e $file) {
         return HTTP_NOT_FOUND;          $request->status(404);
           return OK;
     }      }
     try {      try {
         my $warnings = 0; # no warning printed          my $warnings = 0; # no warning printed
Line 74  sub convert_problem { Line 76  sub convert_problem {
         $request->print($text);          $request->print($text);
         return OK;          return OK;
     } catch {      } catch {
         die "convert failed for $file: $_";          $request->content_type('text/plain');
         #$request->print('<?xml version="1.0" encoding="UTF-8"?>'."\n");          $request->print("convert failed for $file: $_");
         #$request->print("<problem>\n");          $request->status(406);
         #$request->print("convert failed for $file: $_");          return OK;
         #$request->print("</problem>\n");  
         #return OK;  
     };      };
 }  }
   
Line 87  sub directory_listing { Line 87  sub directory_listing {
     my ($uri, $request) = @_;      my ($uri, $request) = @_;
     my $dirpath = &Apache::lonnet::filelocation('', $uri);      my $dirpath = &Apache::lonnet::filelocation('', $uri);
     if (! -e $dirpath) {      if (! -e $dirpath) {
         return HTTP_NOT_FOUND;          $request->status(404);
           return OK;
     }      }
     $dirpath =~ s/\/$//;      $dirpath =~ s/\/$//;
     opendir my $dir, $dirpath or die "Cannot open directory: $dirpath";      opendir my $dir, $dirpath or die "Cannot open directory: $dirpath";
Line 125  sub directory_listing { Line 126  sub directory_listing {
     return OK;      return OK;
 }  }
   
 # NOTE: binaries should be sent directly be Apache  
 # sub send_binary {  
 #     my ($request, $filepath) = @_;  
 #   
 #     $buffer = '';  
 #     if (!open(FILE, "<", $filepath)) {  
 #         return HTTP_NOT_FOUND;  
 #     }  
 #     binmode(FILE);  
 #   
 #     # Read file in 32K blocks  
 #     while ((read(FILE, $buffer, 32768)) != 0) {  
 #         $request->print($buffer);  
 #     }   
 #   
 #     if (!close(FILE)) {  
 #         &Apache::lonnet::logthis("Error closing the file $filepath");  
 #     }  
 #     return OK;  
 # }  
   
 1;  1;
 __END__  __END__

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>