--- loncom/auth/loncacc.pm 1999/11/16 19:14:15 1.2 +++ loncom/auth/loncacc.pm 2000/07/01 17:57:01 1.7 @@ -1,12 +1,14 @@ # The LearningOnline Network # Cookie Based Access Handler for Construction Area # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer) -# 6/15,16/11 Gerd Kortemeyer +# 6/15,16/11,22/11, +# 01/06,01/11,6/1 Gerd Kortemeyer package Apache::loncacc; use strict; use Apache::Constants qw(:common :http); +use Apache::File; use CGI::Cookie(); sub handler { @@ -40,18 +42,30 @@ sub handler { for ($envi=0;$envi<=$#profile;$envi++) { chomp($profile[$envi]); my ($envname,$envvalue)=split(/=/,$profile[$envi]); - $r->subprocess_env("profile.$envname" => "$envvalue"); + $r->subprocess_env("$envname" => "$envvalue"); } - $r->subprocess_env("request.state" => "construct"); + $r->subprocess_env("user.environment" => "$lonidsdir/$handle.id", + "request.state" => "construct", + "request.filename" => $r->filename); + my $buffer; + $r->read($buffer,$r->header_in('Content-length')); + my @pairs=split(/&/,$buffer); + my $pair; my $name; my $value; + foreach $pair (@pairs) { + ($name,$value) = split(/=/,$pair); + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + $r->subprocess_env("form.$name" => $value); + } return OK; } else { $r->log_reason("Cookie $handle not valid", $r->filename) }; } - $cookie=CGI::Cookie->new(-name => 'lonURL', - -value => $requrl, - -path => '/'); - $r->err_headers_out->add('Set-Cookie' => $cookie); + +# ----------------------------------------------- Store where they wanted to go + + $ENV{'request.firsturl'}=$requrl; return FORBIDDEN; }