--- loncom/auth/loncacc.pm 2000/01/14 21:12:40 1.5 +++ loncom/auth/loncacc.pm 2000/09/28 17:01:17 1.10 @@ -2,12 +2,13 @@ # Cookie Based Access Handler for Construction Area # (lonacc: 5/21/99,5/22,5/29,5/31 Gerd Kortemeyer) # 6/15,16/11,22/11, -# 01/06,01/11 Gerd Kortemeyer +# 01/06,01/11,6/1,9/25,9/28 Gerd Kortemeyer package Apache::loncacc; use strict; -use Apache::Constants qw(:common :http); +use Apache::Constants qw(:common :http :methods); +use Apache::File; use CGI::Cookie(); sub handler { @@ -41,28 +42,42 @@ sub handler { for ($envi=0;$envi<=$#profile;$envi++) { chomp($profile[$envi]); my ($envname,$envvalue)=split(/=/,$profile[$envi]); - $r->subprocess_env("$envname" => "$envvalue"); + $ENV{$envname} = $envvalue; } - $r->subprocess_env("user.environment" => "$lonidsdir/$handle.id", - "request.state" => "construct", - "request.filename" => $r->filename); + $ENV{'user.environment'} = "$lonidsdir/$handle.id"; + $ENV{'request.state'} = "construct"; + $ENV{'request.filename'} = $r->filename; + +# -------------------------------------------------------- Load POST parameters + + my $buffer; + $r->read($buffer,$r->header_in('Content-length')); my @pairs=split(/&/,$buffer); - my $pair; my $name; my $value; + my $pair; foreach $pair (@pairs) { - ($name,$value) = split(/=/,$pair); - $r->subprocess_env("form.$name" => $value); + my ($name,$value) = split(/=/,$pair); + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + $name =~ tr/+/ /; + $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + $ENV{"form.$name"}=$value; } + + $r->method_number(M_GET); + $r->method('GET'); + $r->headers_in->unset('Content-length'); + 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; }