httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik600 <nik...@gmail.com>
Subject best way to return the content of a file
Date Sat, 18 Aug 2012 08:51:59 GMT
Dear all

what is the best way to return the content of a file (the content
could be also binary).

I'm writing a custom module that sends some headers to the client and
then need to print out the content of a file.

Is better:

- to read the file and then send is using ap_rprintf
- to use apr_bucket_*
- to simply redirect the request changing the r->uri and then return DECLINED.

I was oriented to the 3rd option but isn't working.

This is my code:

***************************************************************************************************
/*
* some check
*/
if(condition){

r->uri = "/data/_01d7aea2d28036e9b1a6aac465d65787";
return DECLINED;

}
***************************************************************************************************

The strange thing is that i get a 404 error and in error.log i get:

[Sat Aug 18 10:49:10 2012] [error] [client 127.0.0.1] File does not
exist: /var/www/data/_01d7aea2d28036e9b1a6aac465d65787
but the path  /var/www/data/_01d7aea2d28036e9b1a6aac465d65787 is valid
and the file exists!

Sould i do something else after changing the uri value?

Thanks to all in advance

-- 
/*************/
nik600
http://www.kumbe.it

Mime
View raw message