#2: Re: mp2] [mod_proxy] [filter] mod_proxy is not playing with my requestfilter.
Posted on 2010-08-25 08:12:27 by aw
James Lee wrote:
> Hi mod_perl community, this is my first post so be gentle with me.
>
> I'm trying to create something which translates a GET request into a POST
> (creating the body dynamically) and then hand off the POST to another
> server.
>
> I have created a mod_perl connection filter to change the GET to a POST in
> the request line. It also adds Content-Length and Content-Type headers and
> this works fine.
>
> I then have a request filter which creates the POST body. This works when
> the request is handled by a PerlResponseHandler but I'm trying to offload
> the request to mod_proxy as the responses can be quite large but I just
> can't get it to play ball. I see the request filter being called but the
> POST body never arrives at the target server. I suspect this is a timing
> issue, ie: mod_proxy kicking in before my request filter but I'm not
> certain.
Exactly. By the time your response handler is invoked, the time for mod_proxy is long past.
One approach would be : have your PerlResponseHandler send the request directly to the
back-end server, using LWP, read the response, and return this response as the response
for your response handler. In other words, do yourself what mod_proxy would do.
>
> Can anybody shed some light on this or correct my approach. I was going to
> add the POST body in the connection filter but it seemed cleaner/easier to
> do it in a request filter.
In the mod_perl documentation, there is somewhere a schema of the different Apache phases,
and when the different handlers get invoked. I beliebe mod_proxygets invoked somewhere
around the Fixup phase, so if you want to beat it, you have to be earlier than that.
>
> I've looked on the mailing list and found a few things that touch on this (
> http://tech.groups.yahoo.com/group/modperl/message/54541) but nothing that's
> close enough to help.
>
> Config below ... I've not included perl code as this message is quite long
> anyway. Please let me know if it would be helpful.
> Thanks in advance, James.
>
>
> ***
> httpd.conf extract:
>
>
> PerlInputFilterHandler Sample::RequestTweaker::change_get_to_post
>
> <Location /reports>
> PerlInputFilterHandler Sample::RequestTweaker::inject_post_data
> ProxyPass http://appserver/reports-engine
> </Location>
>
Report this message |
#3: Re: mp2] [mod_proxy] [filter] mod_proxy is not playing with myrequest filter.
Posted on 2010-08-25 10:41:05 by James Lee
--001636c5b018a1c8d5048ea1d726
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi Andre, thanks for the response.
I don't actually want to use a PerlResponseHandler, I was just using that t=
o
make sure my filter did what I wanted it to do.
I actually wanted the request filter to add the POST body expecting then
that mod_proxy would do the rest. I expected mod_proxy to kick in around
PerlTransHandler time but wasn't sure when my request filter got called.
Either way it wasn't working :)
I may see whether I can get the connection filter to add the content I was
just after a little clarification when filters were called in relation to
mod_proxy.
Thanks again.
On 25 August 2010 07:12, Andr=E9 Warnier <aw@ice-sa.com> wrote:
> James Lee wrote:
>
>> Hi mod_perl community, this is my first post so be gentle with me.
>>
>> I'm trying to create something which translates a GET request into a POS=
T
>> (creating the body dynamically) and then hand off the POST to another
>> server.
>>
>> I have created a mod_perl connection filter to change the GET to a POST =
in
>> the request line. It also adds Content-Length and Content-Type headers a=
nd
>> this works fine.
>>
>> I then have a request filter which creates the POST body. This works whe=
n
>> the request is handled by a PerlResponseHandler but I'm trying to offloa=
d
>> the request to mod_proxy as the responses can be quite large but I just
>> can't get it to play ball. I see the request filter being called but the
>> POST body never arrives at the target server. I suspect this is a timing
>> issue, ie: mod_proxy kicking in before my request filter but I'm not
>> certain.
>>
>
> Exactly. By the time your response handler is invoked, the time for
> mod_proxy is long past.
>
> One approach would be : have your PerlResponseHandler send the request
> directly to the back-end server, using LWP, read the response, and return
> this response as the response for your response handler. In other words,=
do
> yourself what mod_proxy would do.
>
>
>
>> Can anybody shed some light on this or correct my approach. I was going =
to
>> add the POST body in the connection filter but it seemed cleaner/easier =
to
>> do it in a request filter.
>>
>
> In the mod_perl documentation, there is somewhere a schema of the differe=
nt
> Apache phases, and when the different handlers get invoked. I beliebe
> mod_proxygets invoked somewhere around the Fixup phase, so if you want to
> beat it, you have to be earlier than that.
>
>
>
>> I've looked on the mailing list and found a few things that touch on thi=
s
>> (
>> http://tech.groups.yahoo.com/group/modperl/message/54541) but nothing
>> that's
>> close enough to help.
>>
>> Config below ... I've not included perl code as this message is quite lo=
ng
>> anyway. Please let me know if it would be helpful.
>> Thanks in advance, James.
>>
>>
>> ***
>> httpd.conf extract:
>>
>>
>> PerlInputFilterHandler Sample::RequestTweaker::change_get_to_post
>>
>> <Location /reports>
>> PerlInputFilterHandler Sample::RequestTweaker::inject_post_data
>> ProxyPass http://appserver/reports-engine
>> </Location>
>>
>>
>
--001636c5b018a1c8d5048ea1d726
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi Andre, thanks for the response.<br><br>I don't actually want to use =
a PerlResponseHandler, I was just using that to make sure my filter did wha=
t I wanted it to do.<br><br>I actually wanted the request filter to add the=
POST body expecting then that mod_proxy would do the rest. I expected mod_=
proxy to kick in around PerlTransHandler time but wasn't sure when my r=
equest filter got called. Either way it wasn't working :)<br>
<br>I may see whether I can get the connection filter to add the content I =
was just after a little clarification when filters were called in relation =
to mod_proxy.<br><br>Thanks again.<br><br><br><div class=3D"gmail_quote">
On 25 August 2010 07:12, Andr=E9 Warnier <span dir=3D"ltr"><<a href=3D"m=
ailto:aw@ice-sa.com">aw@ice-sa.com</a>></span> wrote:<br><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px sol=
id rgb(204, 204, 204); padding-left: 1ex;">
<div class=3D"im">James Lee wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi mod_perl community, this is my first post so be gentle with me.<br>
<br>
I'm trying to create something which translates a GET request into a PO=
ST<br>
(creating the body dynamically) and then hand off the POST to another<br>
server.<br>
<br>
I have created a mod_perl connection filter to change the GET to a POST in<=
br>
the request line. It also adds Content-Length and Content-Type headers and<=
br>
this works fine.<br>
<br>
I then have a request filter which creates the POST body. This works when<b=
r>
the request is handled by a PerlResponseHandler but I'm trying to offlo=
ad<br>
the request to mod_proxy as the responses can be quite large but I just<br>
can't get it to play ball. I see the request filter being called but th=
e<br>
POST body never arrives at the target server. I suspect this is a timing<br=
>
issue, ie: mod_proxy kicking in before my request filter but I'm not<br=
>
certain.<br>
</blockquote>
<br></div>
Exactly. By the time your response handler is invoked, the time for mod_pro=
xy is long past.<br>
<br>
One approach would be : have your PerlResponseHandler send the request dire=
ctly to the back-end server, using LWP, read the response, and return this =
response as the response for your response handler. =A0In other words, do y=
ourself what mod_proxy would do.<div class=3D"im">
<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Can anybody shed some light on this or correct my approach. I was going to<=
br>
add the POST body in the connection filter but it seemed cleaner/easier to<=
br>
do it in a request filter.<br>
</blockquote>
<br></div>
In the mod_perl documentation, there is somewhere a schema of the different=
Apache phases, and when the different handlers get invoked. =A0I beliebe m=
od_proxygets invoked somewhere around the Fixup phase, so if you want to be=
at it, you have to be earlier than that.<div>
<div></div><div class=3D"h5"><br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
I've looked on the mailing list and found a few things that touch on th=
is (<br>
<a href=3D"http://tech.groups.yahoo.com/group/modperl/message/54541" target=
=3D"_blank">http://tech.groups.yahoo.com/group/modperl/messa ge/54541</a>) b=
ut nothing that's<br>
close enough to help.<br>
<br>
Config below ... I've not included perl code as this message is quite l=
ong<br>
anyway. Please let me know if it would be helpful.<br>
Thanks in advance, James.<br>
<br>
<br>
***<br>
httpd.conf extract:<br>
<br>
<br>
PerlInputFilterHandler Sample::RequestTweaker::change_get_to_post<br>
<br>
<Location /reports><br>
=A0 PerlInputFilterHandler Sample::RequestTweaker::inject_post_data<br>
=A0 ProxyPass <a href=3D"http://appserver/reports-engine" target=3D"_blank=
">http://appserver/reports-engine</a><br>
</Location><br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>
--001636c5b018a1c8d5048ea1d726--
Report this message |
#4: Re: mp2] [mod_proxy] [filter] mod_proxy is not playing with myrequest filter.
Posted on 2010-08-26 18:28:47 by James Lee
--001636c5a2581c6ab1048ebc7eb5
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I'm still having issues attempting to modify the body of an http request -
this time using a FilterConnectionHandler.
I've had to park this due to deadlines and write it using LWP in a
PerlResponseHandler. This is far from ideal as some of the responses are
upwards of 5MB, and what I'm trying to do does feel very doable in mod_perl=
..
What I really want is to be able to do is pass the request off to mod_proxy
(which I assume is better setup for streaming responses through Apache ... =
I
may be wrong) and then through mod_deflate to compress the results.
I've attached the code and configuration if anybody has a second and could
shed some light over what I'm doing wrong.
I'm basically trying to convert a GET request to 'http://hostname/echo' int=
o
a POST request and attach a payload, however as it hangs mod_proxy becomes
largely academic.
Again any help would be much appreciated.
Thanks, James.
PerlModule Example::Echo
PerlModule Example::ConnectionFilter
PerlInputFilterHandler Example::ConnectionFilter::forward_get_as_post
<Location /echo>
SetHandler modperl
PerlResponseHandler Example::Echo
</Location>
package Example::Echo;
use strict;
use warnings;
use Apache2::Const -compile =3D> qw(OK);
use Apache2::RequestIO;
use Apache2::RequestRec;
sub handler
{
my $r =3D shift;
$r->content_type('text/plain');
$r->read(my $buffer, 1024);
$r->print("received post data: '".$buffer."'");
return Apache2::Const::OK;
}
1;
package Example::ConnectionFilter;
use strict;
use warnings;
use base qw/Apache2::Filter/;
use Apache2::Connection;
use Apache2::Const -compile =3D> qw(OK DECLINED);
use Apache2::FilterRec;
use Apache2::Log;
use Apache2::RequestRec;
use Apache2::RequestIO;
use APR::Const -compile =3D> ':common';
use APR::Brigade;
use APR::Bucket;
use APR::BucketType;
use APR::Error;
sub forward_get_as_post :FilterConnectionHandler
{
my ($f, $bb, $mode, $block, $readbytes) =3D @_;
my $ctx =3D $f->ctx || { 'state' =3D> 'waiting_for_request_line' };
warn "state =3D ".$ctx->{'state'}."\r\n";
# check whether we need to process this request.
return Apache2::Const::DECLINED if ($ctx->{'state'} eq 'ignore');
# read into a tmp brigade.
my $connection =3D $f->c;
my $tmp_bb =3D APR::Brigade->new($connection->pool,
$connection->bucket_alloc);
my $rv =3D $f->next->get_brigade($tmp_bb, $mode, $block, $readbytes);
return $rv unless $rv == APR::Const::SUCCESS;
while (!$tmp_bb->is_empty)
{
# pop buckets from this brigade.
my $bucket =3D $tmp_bb->first;
$bucket->remove();
if ($ctx->{'state'} eq 'waiting_for_request_line')
{
# assumes request line is first bucket.
$bucket->read(my $request_line);
my ($method, $uri, $version) =3D ($request_line =3D~ m|^(.*?) (=
..*?)
HTTP/(.*?)\r\n$|);
if (defined ($method) and $method eq "GET" and $uri =3D~
m|^/echo|)
{
my $new_uri =3D 'POST '.$uri.' HTTP/'.$version."\r\n";
my $new_uri_bucket =3D
APR::Bucket->new($connection->bucket_alloc, $new_uri);
$bb->insert_tail($new_uri_bucket);
my $bucket2 =3D APR::Bucket->new($connection->bucket_alloc,
"Content-Type: application/x-www-form-urlencoded\r\n");
$bb->insert_tail($bucket2);
my $bucket3 =3D APR::Bucket->new($connection->bucket_alloc,
"Content-Length: 9\r\n");
$bb->insert_tail($bucket3);
$ctx->{'state'} =3D 'waiting_for_end_of_headers';
}
else
{
$bb->insert_tail($bucket);
$ctx->{'state'} =3D 'ignore';
}
}
elsif ($ctx->{'state'} eq 'waiting_for_end_of_headers')
{
$bucket->read(my $header);
warn "received header ... ".$header."\r\n";
if ($header =3D~ m|^\r\n$|)
{
warn "detected end_of_headers\r\n";
my $post_data =3D &get_post_data();
### as soon as I add 'data=3Dtest' to this bucket the reque=
st
appears to hang.
############################################
my $end_of_headers_bucket =3D
APR::Bucket->new($connection->bucket_alloc, "\r\ndata=3Dtest");
$bb->insert_tail($end_of_headers_bucket);
$ctx->{'state'} =3D 'finished';
}
else
{
$bb->insert_tail($bucket);
}
}
}
# set context.
$f->ctx($ctx);
return Apache2::Const::OK;
}
1;
On 25 August 2010 09:41, James Lee <modperl.nunk@gmail.com> wrote:
> Hi Andre, thanks for the response.
>
> I don't actually want to use a PerlResponseHandler, I was just using that
> to make sure my filter did what I wanted it to do.
>
> I actually wanted the request filter to add the POST body expecting then
> that mod_proxy would do the rest. I expected mod_proxy to kick in around
> PerlTransHandler time but wasn't sure when my request filter got called.
> Either way it wasn't working :)
>
> I may see whether I can get the connection filter to add the content I wa=
s
> just after a little clarification when filters were called in relation to
> mod_proxy.
>
> Thanks again.
>
>
>
> On 25 August 2010 07:12, Andr=E9 Warnier <aw@ice-sa.com> wrote:
>
>> James Lee wrote:
>>
>>> Hi mod_perl community, this is my first post so be gentle with me.
>>>
>>> I'm trying to create something which translates a GET request into a PO=
ST
>>> (creating the body dynamically) and then hand off the POST to another
>>> server.
>>>
>>> I have created a mod_perl connection filter to change the GET to a POST
>>> in
>>> the request line. It also adds Content-Length and Content-Type headers
>>> and
>>> this works fine.
>>>
>>> I then have a request filter which creates the POST body. This works wh=
en
>>> the request is handled by a PerlResponseHandler but I'm trying to offlo=
ad
>>> the request to mod_proxy as the responses can be quite large but I just
>>> can't get it to play ball. I see the request filter being called but th=
e
>>> POST body never arrives at the target server. I suspect this is a timin=
g
>>> issue, ie: mod_proxy kicking in before my request filter but I'm not
>>> certain.
>>>
>>
>> Exactly. By the time your response handler is invoked, the time for
>> mod_proxy is long past.
>>
>> One approach would be : have your PerlResponseHandler send the request
>> directly to the back-end server, using LWP, read the response, and retur=
n
>> this response as the response for your response handler. In other words=
, do
>> yourself what mod_proxy would do.
>>
>>
>>
>>> Can anybody shed some light on this or correct my approach. I was going
>>> to
>>> add the POST body in the connection filter but it seemed cleaner/easier
>>> to
>>> do it in a request filter.
>>>
>>
>> In the mod_perl documentation, there is somewhere a schema of the
>> different Apache phases, and when the different handlers get invoked. I
>> beliebe mod_proxygets invoked somewhere around the Fixup phase, so if yo=
u
>> want to beat it, you have to be earlier than that.
>>
>>
>>
>>> I've looked on the mailing list and found a few things that touch on th=
is
>>> (
>>> http://tech.groups.yahoo.com/group/modperl/message/54541) but nothing
>>> that's
>>> close enough to help.
>>>
>>> Config below ... I've not included perl code as this message is quite
>>> long
>>> anyway. Please let me know if it would be helpful.
>>> Thanks in advance, James.
>>>
>>>
>>> ***
>>> httpd.conf extract:
>>>
>>>
>>> PerlInputFilterHandler Sample::RequestTweaker::change_get_to_post
>>>
>>> <Location /reports>
>>> PerlInputFilterHandler Sample::RequestTweaker::inject_post_data
>>> ProxyPass http://appserver/reports-engine
>>> </Location>
>>>
>>>
>>
>
--001636c5a2581c6ab1048ebc7eb5
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
I'm still having issues attempting to modify the body of an http reques=
t - this time using a FilterConnectionHandler.<br><br>I've had to park =
this due to deadlines and write it using LWP in a PerlResponseHandler. This=
is far from ideal as some of the responses are upwards of 5MB, and what I&=
#39;m trying to do does feel very doable in mod_perl.<br>
<br>What I really want is to be able to do is pass the request off to mod_p=
roxy (which I assume is better setup for streaming responses through Apache=
... I may be wrong) and then through mod_deflate to compress the results.<=
br>
<br>I've attached the code and configuration if anybody has a second an=
d could shed some light over what I'm doing wrong.<br><br>I'm basic=
ally trying to convert a GET request to '<a href=3D"http://hostname/ech=
o">http://hostname/echo</a>' into a POST request and attach a payload, =
however as it hangs mod_proxy becomes largely academic.<br>
<br>Again any help would be much appreciated.<br>Thanks, James.<br><br><br>=
PerlModule Example::Echo<br>PerlModule Example::ConnectionFilter<br><br>Per=
lInputFilterHandler Example::ConnectionFilter::forward_get_as_post<br><br>
<Location /echo><br> =A0 SetHandler modperl<br> =A0 PerlRes=
ponseHandler Example::Echo<br></Location><br><br><br><br>package Exam=
ple::Echo;<br><br>use strict;<br>use warnings;<br><br>use Apache2::Const -c=
ompile =3D> qw(OK);<br>
use Apache2::RequestIO;<br>use Apache2::RequestRec;<br><br><br>sub handler<=
br>{<br> =A0 my $r =3D shift;<br><br> =A0 $r->content_type(=
9;text/plain');<br> =A0 $r->read(my $buffer, 1024);<br> =
=A0 $r->print("received post data: '".$buffer."'&=
quot;);<br>
=A0 <br> =A0 return Apache2::Const::OK;<br>}<br><br><br>1;<br><b=
r><br><br>package Example::ConnectionFilter;<br><br>use strict;<br>use warn=
ings;<br><br>use base qw/Apache2::Filter/;<br><br>use Apache2::Connection;<=
br>use Apache2::Const -compile =3D> qw(OK DECLINED);<br>
use Apache2::FilterRec;<br>use Apache2::Log;<br>use Apache2::RequestRec;<br=
>use Apache2::RequestIO;<br><br>use APR::Const -compile =3D> ':commo=
n';<br>use APR::Brigade;<br>use APR::Bucket;<br>use APR::BucketType;<br=
>
use APR::Error;<br><br><br>sub forward_get_as_post :FilterConnectionHandler=
<br>{<br> =A0 my ($f, $bb, $mode, $block, $readbytes) =3D @_;<br>=A0=
my $ctx =3D $f->ctx || { 'state' =3D> 'waiting_for=
_request_line' };<br>
=A0 <br> =A0 warn "state =3D ".$ctx->{'state=
9;}."\r\n";<br><br> =A0 # check whether we need to process t=
his request.<br> =A0 return Apache2::Const::DECLINED if ($ctx->{=
9;state'} eq 'ignore');<br>
=A0 <br> =A0 # read into a tmp brigade.<br> =A0 my $connect=
ion =3D $f->c;<br> =A0 my $tmp_bb =3D APR::Brigade->new($connect=
ion->pool, $connection->bucket_alloc);<br> =A0 my $rv =3D $f->=
;next->get_brigade($tmp_bb, $mode, $block, $readbytes);<br>
=A0 <br> =A0 return $rv unless $rv == APR::Const::SUCCESS;<b=
r> =A0 <br> =A0 while (!$tmp_bb->is_empty)<br> =A0 {<br>=
=A0 =A0 # pop buckets from this brigade.<br> =A0 =A0=
my $bucket =3D $tmp_bb->first;<br> =A0 =A0 $bucket->remov=
e();<br>
<br> =A0 =A0 if ($ctx->{'state'} eq 'waiting_for_=
request_line')<br> =A0 =A0 {<br> =A0 =A0 =
=A0 # assumes request line is first bucket.<br> =A0 =A0 =
=A0 $bucket->read(my $request_line);<br> =A0 =A0 =A0 my=
($method, $uri, $version) =3D ($request_line =3D~ m|^(.*?) (.*?) HTTP/(.*?=
)\r\n$|);<br>
=A0 =A0 =A0 <br> =A0 =A0 =A0 if (defined=
($method) and $method eq "GET" and $uri =3D~ m|^/echo|)<br>=A0=
=A0 =A0 {<br> =A0 =A0 =A0 =A0 my =
$new_uri =3D 'POST '.$uri.' HTTP/'.$version."\r\n"=
;;<br>
=A0 =A0 =A0 =A0 my $new_uri_bucket =3D APR::Bucket-=
>new($connection->bucket_alloc, $new_uri);<br> =A0 =A0 =A0=
=A0 <br> =A0 =A0 =A0 =A0 $bb->insert=
_tail($new_uri_bucket);<br> =A0 =A0 =A0 =A0 <br>=A0=
=A0 =A0 =A0 my $bucket2 =3D APR::Bucket->new($c=
onnection->bucket_alloc, "Content-Type: application/x-www-form-urle=
ncoded\r\n");<br>
=A0 =A0 =A0 =A0 $bb->insert_tail($bucket2);<br>=
=A0 =A0 =A0 =A0 <br> =A0 =A0 =A0 =
=A0 my $bucket3 =3D APR::Bucket->new($connection->bucket_alloc,=
"Content-Length: 9\r\n");<br> =A0 =A0 =A0 =A0=
$bb->insert_tail($bucket3);<br>
=A0 =A0 =A0 =A0 <br> =A0 =A0 =A0 =
=A0 $ctx->{'state'} =3D 'waiting_for_end_of_headers=
9;;<br> =A0 =A0 =A0 }<br> =A0 =A0 =A0 els=
e<br> =A0 =A0 =A0 {<br> =A0 =A0 =A0 =A0=
$bb->insert_tail($bucket);<br> =A0 =A0 =A0 =A0=
$ctx->{'state'} =3D 'ignore';<br>
=A0 =A0 =A0 }<br> =A0 =A0 }<br> =A0 =A0=
elsif ($ctx->{'state'} eq 'waiting_for_end_of_headers=
')<br> =A0 =A0 {<br> =A0 =A0 =A0 $bucket-&g=
t;read(my $header);<br> =A0 =A0 =A0 warn "received he=
ader ... ".$header."\r\n";<br>
<br> =A0 =A0 =A0 if ($header =3D~ m|^\r\n$|)<br> =A0 =
=A0 =A0 {<br> =A0 =A0 =A0 =A0 warn "=
;detected end_of_headers\r\n";<br> =A0 =A0 =A0 =
=A0 <br> =A0 =A0 =A0 =A0 my $post_data =3D &get_=
post_data();<br> =A0 =A0 =A0 =A0 <br>
=A0 =A0 =A0 =A0 <br> =A0 =A0 =A0 =
=A0 ### as soon as I add 'data=3Dtest' to this bucket the req=
uest appears to hang.<br> =A0 =A0 =A0 =A0 ##########=
##################################<br> =A0 =A0 =A0 =
=A0 <br> =A0 =A0 =A0 =A0 <br>
=A0 =A0 =A0 =A0 my $end_of_headers_bucket =3D APR::=
Bucket->new($connection->bucket_alloc, "\r\ndata=3Dtest");<=
br> =A0 =A0 =A0 =A0 <br> =A0 =A0 =
=A0 =A0 $bb->insert_tail($end_of_headers_bucket);<br> =A0 =A0=
=A0 =A0 $ctx->{'state'} =3D 'finished'=
;;<br>
=A0 =A0 =A0 }<br> =A0 =A0 =A0 else<br>=
=A0 =A0 =A0 {<br> =A0 =A0 =A0 =A0 =
$bb->insert_tail($bucket);<br> =A0 =A0 =A0 }<br> =
=A0 =A0 }<br> =A0 }<br><br> =A0 # set context. =A0 <br=
> =A0 $f->ctx($ctx);<br><br> =A0 return Apache2::Const::OK;<br=
>
}<br><br><br>1;<br><br><br><br><br><br><br><br><div class=3D"gmail_quote">O=
n 25 August 2010 09:41, James Lee <span dir=3D"ltr"><<a href=3D"mailto:m=
odperl.nunk@gmail.com">modperl.nunk@gmail.com</a>></span> wrote:<br><blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-le=
ft: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Andre, thanks for the response.<br><br>I don't actually want to use =
a PerlResponseHandler, I was just using that to make sure my filter did wha=
t I wanted it to do.<br><br>I actually wanted the request filter to add the=
POST body expecting then that mod_proxy would do the rest. I expected mod_=
proxy to kick in around PerlTransHandler time but wasn't sure when my r=
equest filter got called. Either way it wasn't working :)<br>
<br>I may see whether I can get the connection filter to add the content I =
was just after a little clarification when filters were called in relation =
to mod_proxy.<br><br>Thanks again.<div><div></div><div class=3D"h5"><br>
<br><br><div class=3D"gmail_quote">
On 25 August 2010 07:12, Andr=E9 Warnier <span dir=3D"ltr"><<a href=3D"m=
ailto:aw@ice-sa.com" target=3D"_blank">aw@ice-sa.com</a>></span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; bo=
rder-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>James Lee wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi mod_perl community, this is my first post so be gentle with me.<br>
<br>
I'm trying to create something which translates a GET request into a PO=
ST<br>
(creating the body dynamically) and then hand off the POST to another<br>
server.<br>
<br>
I have created a mod_perl connection filter to change the GET to a POST in<=
br>
the request line. It also adds Content-Length and Content-Type headers and<=
br>
this works fine.<br>
<br>
I then have a request filter which creates the POST body. This works when<b=
r>
the request is handled by a PerlResponseHandler but I'm trying to offlo=
ad<br>
the request to mod_proxy as the responses can be quite large but I just<br>
can't get it to play ball. I see the request filter being called but th=
e<br>
POST body never arrives at the target server. I suspect this is a timing<br=
>
issue, ie: mod_proxy kicking in before my request filter but I'm not<br=
>
certain.<br>
</blockquote>
<br></div>
Exactly. By the time your response handler is invoked, the time for mod_pro=
xy is long past.<br>
<br>
One approach would be : have your PerlResponseHandler send the request dire=
ctly to the back-end server, using LWP, read the response, and return this =
response as the response for your response handler. =A0In other words, do y=
ourself what mod_proxy would do.<div>
<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Can anybody shed some light on this or correct my approach. I was going to<=
br>
add the POST body in the connection filter but it seemed cleaner/easier to<=
br>
do it in a request filter.<br>
</blockquote>
<br></div>
In the mod_perl documentation, there is somewhere a schema of the different=
Apache phases, and when the different handlers get invoked. =A0I beliebe m=
od_proxygets invoked somewhere around the Fixup phase, so if you want to be=
at it, you have to be earlier than that.<div>
<div></div><div><br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
I've looked on the mailing list and found a few things that touch on th=
is (<br>
<a href=3D"http://tech.groups.yahoo.com/group/modperl/message/54541" target=
=3D"_blank">http://tech.groups.yahoo.com/group/modperl/messa ge/54541</a>) b=
ut nothing that's<br>
close enough to help.<br>
<br>
Config below ... I've not included perl code as this message is quite l=
ong<br>
anyway. Please let me know if it would be helpful.<br>
Thanks in advance, James.<br>
<br>
<br>
***<br>
httpd.conf extract:<br>
<br>
<br>
PerlInputFilterHandler Sample::RequestTweaker::change_get_to_post<br>
<br>
<Location /reports><br>
=A0 PerlInputFilterHandler Sample::RequestTweaker::inject_post_data<br>
=A0 ProxyPass <a href=3D"http://appserver/reports-engine" target=3D"_blank=
">http://appserver/reports-engine</a><br>
</Location><br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>
--001636c5a2581c6ab1048ebc7eb5--
Report this message |
#5: Re: mp2] [mod_proxy] [filter] mod_proxy is not playing with my request filter.
Posted on 2010-08-26 19:47:48 by torsten.foertsch
On Thursday, August 26, 2010 18:28:47 James Lee wrote:
A few comments below.
The goal of the code is to fill up $bb. Nothing is copied there unless you =
do.
The way you do it is to start with an empty brigade.
> sub forward_get_as_post :FilterConnectionHandler
> {
> my ($f, $bb, $mode, $block, $readbytes) =3D @_;
> my $ctx =3D $f->ctx || { 'state' =3D> 'waiting_for_request_line' };
>=20
> warn "state =3D ".$ctx->{'state'}."\r\n";
>=20
> # check whether we need to process this request.
> return Apache2::Const::DECLINED if ($ctx->{'state'} eq 'ignore');
>=20
> # read into a tmp brigade.
> my $connection =3D $f->c;
> my $tmp_bb =3D APR::Brigade->new($connection->pool,
> $connection->bucket_alloc);
> my $rv =3D $f->next->get_brigade($tmp_bb, $mode, $block, $readbytes);
>=20
> return $rv unless $rv == APR::Const::SUCCESS;
>=20
> while (!$tmp_bb->is_empty)
> {
> # pop buckets from this brigade.
> my $bucket =3D $tmp_bb->first;
> $bucket->remove();
>=20
> if ($ctx->{'state'} eq 'waiting_for_request_line')
> {
> # assumes request line is first bucket.
> $bucket->read(my $request_line);
> my ($method, $uri, $version) =3D ($request_line =3D~ m|^(.*?)=
(.*?)
> HTTP/(.*?)\r\n$|);
>=20
> if (defined ($method) and $method eq "GET" and $uri =3D~
> m|^/echo|)
> {
> my $new_uri =3D 'POST '.$uri.' HTTP/'.$version."\r\n";
> my $new_uri_bucket =3D
> APR::Bucket->new($connection->bucket_alloc, $new_uri);
>=20
> $bb->insert_tail($new_uri_bucket);
>=20
> my $bucket2 =3D APR::Bucket->new($connection->bucket_allo=
c,
> "Content-Type: application/x-www-form-urlencoded\r\n");
> $bb->insert_tail($bucket2);
>=20
> my $bucket3 =3D APR::Bucket->new($connection->bucket_allo=
c,
> "Content-Length: 9\r\n");
> $bb->insert_tail($bucket3);
by now you have inserted these lines:
POST /echo HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 9
You have read the 1st bucket of the input. That bucket may (or may not)=20
contain the whole request including the empty line that signals end-of-
headers. So, you have to check also the rest of the bucket.
>=20
> $ctx->{'state'} =3D 'waiting_for_end_of_headers';
> }
> else
> {
> $bb->insert_tail($bucket);
> $ctx->{'state'} =3D 'ignore';
> }
> }
> elsif ($ctx->{'state'} eq 'waiting_for_end_of_headers')
> {
> $bucket->read(my $header);
> warn "received header ... ".$header."\r\n";
>=20
> if ($header =3D~ m|^\r\n$|)
> {
> warn "detected end_of_headers\r\n";
>=20
> my $post_data =3D &get_post_data();
>=20
>=20
> ### as soon as I add 'data=3Dtest' to this bucket the req=
uest
> appears to hang.
> ############################################
>=20
>=20
> my $end_of_headers_bucket =3D
> APR::Bucket->new($connection->bucket_alloc, "\r\ndata=3Dtest");
>=20
> $bb->insert_tail($end_of_headers_bucket);
by now you have sent
POST /echo HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 9
data=3Dtest
Correct me if I am wrong but don't you have to insert an EOS marker? Haven'=
t=20
tried connection input filter yet. But normally a stream is closed with a
$bb->insert_tail(APR::Bucket::eos_create $connection->bucket_alloc);
> $ctx->{'state'} =3D 'finished';
> }
> else
> {
> $bb->insert_tail($bucket);
> }
> }
> }
>=20
> # set context.
> $f->ctx($ctx);
>=20
> return Apache2::Const::OK;
> }
If it works with the EOS bucket it will probably work for most of the=20
requests. But RFC2616 doesn't forbid GET requests to have a request body. T=
hat=20
means you should read the input until EOS. Don't know if your code does tha=
t=20
actually. Otherwise your client may still send the request while your handl=
er=20
is already done with the response.
Torsten F=F6rtsch
=2D-=20
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
Report this message |
#6: Re: mp2] [mod_proxy] [filter] mod_proxy is not playing with myrequest filter.
Posted on 2010-08-26 21:12:18 by James Lee
--0016e6d7787ce9685d048ebec696
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi, thanks for the response.
To my knowledge (which is about a weeks worth) you don't need or indeed see
an end_of_stream bucket in a connection filter till the connection is close=
d
and then only in the output filter.
Conveniently the request headers seem to be passed from the core filter one
brigade at a time which makes my code quite easy, no need for buffering
buckets between calls. As I said the code works fine until I append the
'data=3Dtest' to the end of the headers which should be my request body.
It's been driving me crazy all day and I can't understand why its doing wha=
t
it is doing! It's just frustrating because it sounds like something I shoul=
d
be able to do.
James.
2010/8/26 Torsten F=F6rtsch <torsten.foertsch@gmx.net>
> On Thursday, August 26, 2010 18:28:47 James Lee wrote:
>
> A few comments below.
>
> The goal of the code is to fill up $bb. Nothing is copied there unless yo=
u
> do.
> The way you do it is to start with an empty brigade.
>
> > sub forward_get_as_post :FilterConnectionHandler
> > {
> > my ($f, $bb, $mode, $block, $readbytes) =3D @_;
> > my $ctx =3D $f->ctx || { 'state' =3D> 'waiting_for_request_line' };
> >
> > warn "state =3D ".$ctx->{'state'}."\r\n";
> >
> > # check whether we need to process this request.
> > return Apache2::Const::DECLINED if ($ctx->{'state'} eq 'ignore');
> >
> > # read into a tmp brigade.
> > my $connection =3D $f->c;
> > my $tmp_bb =3D APR::Brigade->new($connection->pool,
> > $connection->bucket_alloc);
> > my $rv =3D $f->next->get_brigade($tmp_bb, $mode, $block, $readbytes=
);
> >
> > return $rv unless $rv == APR::Const::SUCCESS;
> >
> > while (!$tmp_bb->is_empty)
> > {
> > # pop buckets from this brigade.
> > my $bucket =3D $tmp_bb->first;
> > $bucket->remove();
> >
> > if ($ctx->{'state'} eq 'waiting_for_request_line')
> > {
> > # assumes request line is first bucket.
> > $bucket->read(my $request_line);
> > my ($method, $uri, $version) =3D ($request_line =3D~ m|^(.*=
?)
> (.*?)
> > HTTP/(.*?)\r\n$|);
> >
> > if (defined ($method) and $method eq "GET" and $uri =3D~
> > m|^/echo|)
> > {
> > my $new_uri =3D 'POST '.$uri.' HTTP/'.$version."\r\n";
> > my $new_uri_bucket =3D
> > APR::Bucket->new($connection->bucket_alloc, $new_uri);
> >
> > $bb->insert_tail($new_uri_bucket);
> >
> > my $bucket2 =3D APR::Bucket->new($connection->bucket_al=
loc,
> > "Content-Type: application/x-www-form-urlencoded\r\n");
> > $bb->insert_tail($bucket2);
> >
> > my $bucket3 =3D APR::Bucket->new($connection->bucket_al=
loc,
> > "Content-Length: 9\r\n");
> > $bb->insert_tail($bucket3);
>
> by now you have inserted these lines:
>
> POST /echo HTTP/1.1
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 9
>
> You have read the 1st bucket of the input. That bucket may (or may not)
> contain the whole request including the empty line that signals end-of-
> headers. So, you have to check also the rest of the bucket.
>
> >
> > $ctx->{'state'} =3D 'waiting_for_end_of_headers';
> > }
> > else
> > {
> > $bb->insert_tail($bucket);
> > $ctx->{'state'} =3D 'ignore';
> > }
> > }
> > elsif ($ctx->{'state'} eq 'waiting_for_end_of_headers')
> > {
> > $bucket->read(my $header);
> > warn "received header ... ".$header."\r\n";
> >
> > if ($header =3D~ m|^\r\n$|)
> > {
> > warn "detected end_of_headers\r\n";
> >
> > my $post_data =3D &get_post_data();
> >
> >
> > ### as soon as I add 'data=3Dtest' to this bucket the
> request
> > appears to hang.
> > ############################################
> >
> >
> > my $end_of_headers_bucket =3D
> > APR::Bucket->new($connection->bucket_alloc, "\r\ndata=3Dtest");
> >
> > $bb->insert_tail($end_of_headers_bucket);
>
> by now you have sent
>
> POST /echo HTTP/1.1
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 9
>
> data=3Dtest
>
> Correct me if I am wrong but don't you have to insert an EOS marker?
> Haven't
> tried connection input filter yet. But normally a stream is closed with a
>
> $bb->insert_tail(APR::Bucket::eos_create $connection->bucket_alloc);
>
> > $ctx->{'state'} =3D 'finished';
> > }
> > else
> > {
> > $bb->insert_tail($bucket);
> > }
> > }
> > }
> >
> > # set context.
> > $f->ctx($ctx);
> >
> > return Apache2::Const::OK;
> > }
>
> If it works with the EOS bucket it will probably work for most of the
> requests. But RFC2616 doesn't forbid GET requests to have a request body.
> That
> means you should read the input until EOS. Don't know if your code does
> that
> actually. Otherwise your client may still send the request while your
> handler
> is already done with the response.
>
> Torsten F=F6rtsch
>
> --
> Need professional modperl support? Hire me! (http://foertsch.name)
>
> Like fantasy? http://kabatinte.net
>
--0016e6d7787ce9685d048ebec696
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi, thanks for the response.<br><br>To my knowledge (which is about a weeks=
worth) you don't need or indeed see an end_of_stream bucket in a conne=
ction filter till the connection is closed and then only in the output filt=
er.<br>
<br>Conveniently the request headers seem to be passed from the core filter=
one brigade at a time which makes my code quite easy, no need for bufferin=
g buckets between calls.=A0 As I said the code works fine until I append th=
e 'data=3Dtest' to the end of the headers which should be my reques=
t body.<br>
<br>
It's been driving me crazy all day and I can't understand why its d=
oing what it is doing! It's just frustrating because it sounds like som=
ething I should be able to do.<br>
<br><br>James.<br><br><br><br><div class=3D"gmail_quote">2010/8/26 Torsten =
F=F6rtsch <span dir=3D"ltr"><<a href=3D"mailto:torsten.foertsch@gmx.net"=
>torsten.foertsch@gmx.net</a>></span><br><blockquote class=3D"gmail_quot=
e" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204,=
204); padding-left: 1ex;">
On Thursday, August 26, 2010 18:28:47 James Lee wrote:<br>
<br>
A few comments below.<br>
<br>
The goal of the code is to fill up $bb. Nothing is copied there unless you =
do.<br>
The way you do it is to start with an empty brigade.<br>
<div><div></div><div class=3D"h5"><br>
> sub forward_get_as_post :FilterConnectionHandler<br>
> {<br>
> =A0 =A0 my ($f, $bb, $mode, $block, $readbytes) =3D @_;<br>
> =A0 =A0 my $ctx =3D $f->ctx || { 'state' =3D> 'waiti=
ng_for_request_line' };<br>
><br>
> =A0 =A0 warn "state =3D ".$ctx->{'state'}."\=
r\n";<br>
><br>
> =A0 =A0 # check whether we need to process this request.<br>
> =A0 =A0 return Apache2::Const::DECLINED if ($ctx->{'state'}=
eq 'ignore');<br>
><br>
> =A0 =A0 # read into a tmp brigade.<br>
> =A0 =A0 my $connection =3D $f->c;<br>
> =A0 =A0 my $tmp_bb =3D APR::Brigade->new($connection->pool,<br>
> $connection->bucket_alloc);<br>
> =A0 =A0 my $rv =3D $f->next->get_brigade($tmp_bb, $mode, $block,=
$readbytes);<br>
><br>
> =A0 =A0 return $rv unless $rv == APR::Const::SUCCESS;<br>
><br>
> =A0 =A0 while (!$tmp_bb->is_empty)<br>
> =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 # pop buckets from this brigade.<br>
> =A0 =A0 =A0 =A0 my $bucket =3D $tmp_bb->first;<br>
> =A0 =A0 =A0 =A0 $bucket->remove();<br>
><br>
> =A0 =A0 =A0 =A0 if ($ctx->{'state'} eq 'waiting_for_req=
uest_line')<br>
> =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 # assumes request line is first bucket.<br>
> =A0 =A0 =A0 =A0 =A0 =A0 $bucket->read(my $request_line);<br>
> =A0 =A0 =A0 =A0 =A0 =A0 my ($method, $uri, $version) =3D ($request_lin=
e =3D~ m|^(.*?) (.*?)<br>
> HTTP/(.*?)\r\n$|);<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 if (defined ($method) and $method eq "GET=
" and $uri =3D~<br>
> m|^/echo|)<br>
> =A0 =A0 =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my $new_uri =3D 'POST '.$uri.&=
#39; HTTP/'.$version."\r\n";<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my $new_uri_bucket =3D<br>
> APR::Bucket->new($connection->bucket_alloc, $new_uri);<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $bb->insert_tail($new_uri_bucket);<=
br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my $bucket2 =3D APR::Bucket->new($c=
onnection->bucket_alloc,<br>
> "Content-Type: application/x-www-form-urlencoded\r\n");<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $bb->insert_tail($bucket2);<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my $bucket3 =3D APR::Bucket->new($c=
onnection->bucket_alloc,<br>
> "Content-Length: 9\r\n");<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $bb->insert_tail($bucket3);<br>
<br>
</div></div>by now you have inserted these lines:<br>
<br>
POST /echo HTTP/1.1<br>
<div class=3D"im">Content-Type: application/x-www-form-urlencoded<br>
</div>Content-Length: 9<br>
<br>
You have read the 1st bucket of the input. That bucket may (or may not)<br>
contain the whole request including the empty line that signals end-of-<br>
headers. So, you have to check also the rest of the bucket.<br>
<div class=3D"im"><br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $ctx->{'state'} =3D 'wa=
iting_for_end_of_headers';<br>
> =A0 =A0 =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 =A0 =A0 =A0 else<br>
> =A0 =A0 =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $bb->insert_tail($bucket);<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $ctx->{'state'} =3D 'ig=
nore';<br>
> =A0 =A0 =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 =A0 elsif ($ctx->{'state'} eq 'waiting_for_=
end_of_headers')<br>
> =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 $bucket->read(my $header);<br>
> =A0 =A0 =A0 =A0 =A0 =A0 warn "received header ... ".$header.=
"\r\n";<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 if ($header =3D~ m|^\r\n$|)<br>
> =A0 =A0 =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 warn "detected end_of_headers\r\n=
";<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my $post_data =3D &get_post_data()=
;<br>
><br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ### as soon as I add 'data=3Dtest&=
#39; to this bucket the request<br>
> appears to hang.<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ######################################=
######<br>
><br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 my $end_of_headers_bucket =3D<br>
> APR::Bucket->new($connection->bucket_alloc, "\r\ndata=3Dtes=
t");<br>
><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $bb->insert_tail($end_of_headers_bu=
cket);<br>
<br>
</div>by now you have sent<br>
<br>
POST /echo HTTP/1.1<br>
<div class=3D"im">Content-Type: application/x-www-form-urlencoded<br>
</div>Content-Length: 9<br>
<br>
data=3Dtest<br>
<br>
Correct me if I am wrong but don't you have to insert an EOS marker? Ha=
ven't<br>
tried connection input filter yet. But normally a stream is closed with a<b=
r>
<br>
$bb->insert_tail(APR::Bucket::eos_create $connection->bucket_alloc);<=
br>
<div class=3D"im"><br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $ctx->{'state'} =3D 'fi=
nished';<br>
> =A0 =A0 =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 =A0 =A0 =A0 else<br>
> =A0 =A0 =A0 =A0 =A0 =A0 {<br>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $bb->insert_tail($bucket);<br>
> =A0 =A0 =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 =A0 =A0 }<br>
> =A0 =A0 }<br>
><br>
> =A0 =A0 # set context.<br>
> =A0 =A0 $f->ctx($ctx);<br>
><br>
> =A0 =A0 return Apache2::Const::OK;<br>
> }<br>
<br>
</div>If it works with the EOS bucket it will probably work for most of the=
<br>
requests. But RFC2616 doesn't forbid GET requests to have a request bod=
y. That<br>
means you should read the input until EOS. Don't know if your code does=
that<br>
actually. Otherwise your client may still send the request while your handl=
er<br>
is already done with the response.<br>
<br>
Torsten F=F6rtsch<br>
<font color=3D"#888888"><br>
--<br>
Need professional modperl support? Hire me! (<a href=3D"http://foertsch.nam=
e" target=3D"_blank">http://foertsch.name</a>)<br>
<br>
Like fantasy? <a href=3D"http://kabatinte.net" target=3D"_blank">http://kab=
atinte.net</a><br>
</font></blockquote></div><br>
--0016e6d7787ce9685d048ebec696--
Report this message |