[EMAIL PROTECTED] <[EMAIL PROTECTED]> said something to this effect on 
12/17/2001:
> I'm recording a url at the beginning of an app to restore the
> entrance url:
> 
> sub set_referer {
>       my $self = shift;
>       if ($self->{R}) {
>               require Apache::Cookie;
>               
>               my $cookie = Apache::Cookie->new($self->{R},
>               -name    =>  "REFERER",
>               -value   =>  $self->{R}->header_in('Referer'),
>               -expires =>  '2d',
>               -domain  =>  ".$NFN::sites{$ENV{SITE}}{domain}",
>               -path    =>  '/'
>                       );
>               $cookie->bake;
>       }
>       
> }
> 
> 
> Which stores the cookie portion like so:
> 
> 
>REFERER=http://www.newsfactor.com/xxxxx.pl%3faction=reply_form_html&board=nfntalkback&id=3288
> 
> However when I pull this back in with Apache::Cookie->fetch,
> the data then reads:
> 
> http://www.newsfactor.com/xxxxx.pl?action=reply_form_html
> 
> Apache::Cookie seems to be stripping out the portion after the first 
> ampersand.
> 
> Anybody know what do do here?

Use escape_uri and unescape_uri, or some other pair of reversable
functions.  For example, store it as:

use Apache::Util qw(escape_uri unescape_uri);
sub set_referer {
        my $self = shift;
        if ($self->{R}) {
                require Apache::Cookie;
                
                my $cookie = Apache::Cookie->new($self->{R},
                -name    =>  "REFERER",
                -value   =>  escape_uri($self->{R}->header_in('Referer')),
                -expires =>  '2d',
                -domain  =>  ".$NFN::sites{$ENV{SITE}}{domain}",
                -path    =>  '/'
                );
                $cookie->bake;
        }
        
}

And then fetch it as:

  my $value = unescape_uri($cookies{'REFERER'});

(darren)

-- 
Men are from earth. Women are from earth. Deal with it.

Reply via email to