httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Plüm, Rüdiger, Vodafone Group <ruediger.pl...@vodafone.com>
Subject RE: Fwd: svn commit: r1377475 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_lua.xml docs/manual/style/scripts/prettify.js modules/lua/lua_vmprep.h modules/lua/mod_lua.c modules/lua/mod_lua.h
Date Mon, 27 Aug 2012 12:35:20 GMT


> -----Original Message-----
> From: Daniel Gruno [mailto:rumble@cord.dk]
> Sent: Montag, 27. August 2012 14:06
> To: dev@httpd.apache.org
> Subject: Re: Fwd: svn commit: r1377475 - in /httpd/httpd/trunk: CHANGES
> docs/manual/mod/mod_lua.xml docs/manual/style/scripts/prettify.js
> modules/lua/lua_vmprep.h modules/lua/mod_lua.c modules/lua/mod_lua.h
> 
> On 08/27/2012 11:59 AM, Plüm, Rüdiger, Vodafone Group wrote:
> >
> > Thanks. I guess you noticed that I found more important issues with
> the code than this comment :-)
> >
> > Regards
> >
> > Rüdiger
> >
> I've tried my best to correct the errors you mentioned, but I'm having

You should try to leave the loop if ap_pass_brigade does not return APR_SUCCESS and should
return this (!= APR_SUCCESS) to
the caller. It is always a bad sign if the return code of ap_pass_brigade gets lost unhandled
or unpassed.

> some trouble figuring out how the input filter should pass along data to
> the next in the chain. What I have currently is this:
> 
> /* Get the output from Lua's yield() as a string */
> const char* output = lua_tolstring(L, 1, &olen);
> /* Make a bucket for it */
> pbktOut = apr_bucket_heap_create(output, olen, 0, c->bucket_alloc);
> /* Add it to the brigade */
> APR_BRIGADE_INSERT_TAIL(pbbOut, pbktOut);
> /* Do something more here involving cleanups or..?? */
> 
> But then what? Am I supposed to make a call to some ap_*_brigade
> function? I've checked some of the example filter modules, but I can't
> seem to find any suitable way of doing this other than finishing up the
> brigade and returning APR_SUCCESS in the end.

Keep the input brigade you fetched in the context and return to the caller.
You will be called again if more data is needed. Then you can continue processing the
data in your context input brigade first and fetch further data on your own if you run
out of data.

Regards

Rüdiger
Mime
View raw message