httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: r->filename.
Date Sat, 25 Oct 2003 19:39:30 GMT
Glenn wrote:

> On Sat, Oct 25, 2003 at 11:33:35AM -0700, Stas Bekman wrote:
> 
>>Ted Rolle wrote:
>>[...]
>>
>>>The calling module has the responsibility of providing a good r->filename,
>>>even when it's not used.
>>
>>what's a good r->filename? /dev/null sounds good to me.
> 
> 
> How about "" as in the empty string containing only the '\0' character?
> This way, filters after the trans_hook could be sure that r->filename
> is never NULL and at the same time, any stat calls on "" will fail.
> Smarter modules would be able to check
>   if (*r->filename != '\0') {
>       ....
>   }
> and modules that require a mapping to the filesystem could quickly do
>   if (*r->filename == '\0') {
>       return DECLINED;
>   }
> to simply decline when they detect that there is no filesystem mapping.

how about something like

ap_request_filename(r) that returns ptr to filename or NULL

ap_request_filename_str(r) that returns ptr to filename or ""

ap_request_filename_set(r, filename) that takes NULL or real filename and does 
the right thing under the covers

Apache >= 2.1 changes name of r->filename field to r->private_filename
Apache >= 2.1 makes sure r->private_filename is set sanely (whatever that is) 
after translate name hook

as far as Apache 2.0...  there are modules that set r->filename to something 
even when it makes no sense...  there are modules that set it to NULL... 
probably modules that expect r->filename==NULL to mean something

probably Apache core shouldn't change the (vague) semantics of r->filename but 
it can provide the access functions mentioned above

modules for 2.0 that look at r->filename could call ap_request_filename() or 
ap_request_filename_str() depending on the requirement (dumb logging code would 
just call _str() version)



Mime
View raw message