--- loncom/lonencurl.pm 2006/12/05 02:55:56 1.3 +++ loncom/lonencurl.pm 2007/10/02 01:10:16 1.4 @@ -1,7 +1,8 @@ + # The LearningOnline Network # URL translation for encrypted filenames # -# $Id: lonencurl.pm,v 1.3 2006/12/05 02:55:56 albertel Exp $ +# $Id: lonencurl.pm,v 1.4 2007/10/02 01:10:16 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,28 +31,24 @@ package Apache::lonencurl; use strict; use Apache::Constants qw(:common :remotehost); -use CGI::Cookie(); use Apache::lonnet; use Apache::lonenc; sub handler { my $r = shift; - my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); - my $lonid=$cookies{'lonID'}; - my $cookie; - if ($lonid) { - my $handle=&LONCAPA::clean_handle($lonid->value); - my $lonidsdir=$r->dir_config('lonIDsDir'); - $env{'request.enc'}=1; - if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { + + $env{'request.enc'}=1; + + my $handle = &Apache::lonnet::check_for_valid_session($r); + if ($handle ne '') { # Initialize Environment - &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); + my $lonidsdir=$r->dir_config('lonIDsDir'); + &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); # Decrypt URL and redirect - my $redirect=&Apache::lonenc::unencrypted($r->uri); - if ($r->args) { $redirect.='?'.$r->args; } - $r->internal_redirect($redirect); - return OK; - } + my $redirect=&Apache::lonenc::unencrypted($r->uri); + if ($r->args) { $redirect.='?'.$r->args; } + $r->internal_redirect($redirect); + return OK; } return FORBIDDEN; } 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.