--0016e6db61e91719d7048935e4b7
Content-Type: text/plain; charset=ISO-8859-1
I want to manipulate various href links in the server response. I read in
the server response as follows:
sub handler
{
my $f = shift;
unless ($f->ctx){
while ($f->read(my $Buffer, BUFF_LEN)) {
if ($Buffer =~ m/Logout/){
$Buffer =~ s/href="(.*?\?.*?)"/href="$1\&NewParameter=$Value"/g;
$f->print($Buffer);
}
return Apache2::Const::OK;
}
}
}
The BUFF_LEN constant is set to 1024. I want to run the regex against the
entire server response. I tried adding a $CompleteBuffer .= $Buffer inside
the while loop and moving the $f->print($Buffer) statement out of that loop,
but still ended up with multiple copies of the same text within $Buffer.
What is the correct what to access the entire server response in a single
variable? Any pointers to examples of this are greatly appreciated.
Thanks,
Chris
--0016e6db61e91719d7048935e4b7
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I want to manipulate various href links in the server=
response. I read in the server response as follows:<br></div><div><br></di=
v><div>sub handler<br>{<br>=A0 my $f =3D shift; </div><div>=A0 unless ($f-=
>ctx){<br>
=A0 =A0 while ($f->read(my $Buffer, BUFF_LEN)) {<br></div><div>=A0 =A0 =
=A0 if ($Buffer =3D~ m/Logout/){</div><div>=A0 =A0 =A0 =A0 $Buffer =3D~ s/h=
ref=3D"(.*?\?.*?)"/href=3D"$1\&NewParameter=3D$Value&quo=
t;/g;</div><div>=A0 =A0 =A0 =A0 $f->print($Buffer);<br>
=A0 =A0 }<br>=A0 =A0 return Apache2::Const::OK;<br>=A0 =A0}<br>=A0 }</d=
iv><div>}</div><div><br></div><div>The BUFF_LEN constant is set to 1024. I =
want to run the regex against the entire server response. I tried adding a =
$CompleteBuffer .=3D $Buffer inside the while loop and moving the $f->pr=
int($Buffer) statement out of that loop, but still ended up with multiple c=
opies of the same text within $Buffer. What is the correct what to access t=
he entire server response in a single variable? Any pointers to examples of=
this are greatly appreciated.</div>
<div><br></div><div>Thanks,</div><div>Chris</div></div>
--0016e6db61e91719d7048935e4b7--
