Should hook phase be ap_hook_translatename or ap_hook_fixup ? ---- MATSUMOTO Ryosuke < matsu1229 at gmail.com > http://blog.matsumoto-r.jp/
On 2012/08/18, at 21:17, nik600 <nik...@gmail.com> wrote: > Thanks for pointing me to the right direction. > > I've already tried to change order of execution i'v also tried to use > APR_HOOK_REALLY_FIRST or APR_HOOK_FIRST or APR_HOOK_MIDDLE but the > result is the same. > > this is my test code: > > ****************************** > static int kcache_handler(request_rec* r) > { > > if (!r->handler || strcmp(r->handler, "kcache")) > return DECLINED; > > if (r->method_number != M_GET) > return HTTP_METHOD_NOT_ALLOWED; > > apr_status_t s; > > r->uri = "/data/_01d7aea2d28036e9b1a6aac465d65787"; > r->unparsed_uri="/data/_01d7aea2d28036e9b1a6aac465d65787"; > r->filename="/var/www/data/_01d7aea2d28036e9b1a6aac465d65787"; > > return DECLINED; > > } > > static void register_hooks(apr_pool_t* pool) > { > > static const char *succ[] = {"mod_proxy.c","mod_alias.c", NULL}; > ap_hook_handler(kcache_handler, NULL, succ, APR_HOOK_REALLY_FIRST); > } > module AP_MODULE_DECLARE_DATA kcache_module = { > STANDARD20_MODULE_STUFF, > NULL, > NULL, > NULL, > NULL, > NULL, > register_hooks > }; > ****************************** > > Any idea? > > Thanks > > > On Sat, Aug 18, 2012 at 12:33 PM, Nick Kew <n...@apache.org> wrote: >> >> On 18 Aug 2012, at 09:51, nik600 wrote: >> >>> Is better: >>> >>> - to read the file and then send is using ap_rprintf >> >> Bad. >> >>> - to use apr_bucket_* >> >> Acceptable. >> >>> - to simply redirect the request changing the r->uri and then return >>> DECLINED. >> >> Yep. >> >>> The strange thing is that i get a 404 error and in error.log i get: >> >> That's because you set r-->uri too late, after it's already been mapped to >> the >> filesystem. >> >> Others have already told you to hook in earlier in the request processing >> cycle. >> I guess it's time to point you at http://www.apachetutor.org/ >> and the new programmer docs at httpd.apache.org. >> >> -- >> Nick Kew > > > > -- > /*************/ > nik600 > http://www.kumbe.it