darren chamberlain wrote:
> [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)
>
>
Thanks darren,
Tried this and it appears that Apache::Util escapes the same characters
that Apache::Cookie does when it prepares this cookie. Problem is that
it wont pull the ampersands back in. I'm assuming the thinking is that
Apache::Cookie shoud be able to decode a string it encodes. I'm running
an older version of mod_perl (1.24_01), wondering if anybody knows if
this issue has been seen before, and if it's been fixed in more recent
versions.
--
--
Daniel Bohling
NewsFactor Network