DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=42404>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=42404 Summary: Filename/info for disk-cached proxied remote URLs not available. Product: Apache httpd-2 Version: 2.2.4 Platform: PC OS/Version: Linux Status: NEW Severity: enhancement Priority: P4 Component: mod_cache AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] I'm not certain whether what I'm reporting is actually a bug, a feature request, or both. Therefore, I've submit it as a low priority enhancement. Normally, Apache has the ability to return the filename for a local resource via PHP's apache_lookup_uri() function call. When Apache is acting as a proxy server, there is no local filename for remote URLs. However, there may be a local file created should mod_disk_cache capture and hold a working copy of a proxied resource (should it be told to do so via the configuration file). Therefore, if a local filename is available, I question whether it should be returned. Currently, the function returns "proxy:REMOTE_URL" for all proxied requests, not a local filename from the disk cache. I would like a local filename returned if one is available. What I'm trying to do: I'm trying to return certain information from my server's disk cache about proxied resources, such as when they were last updated (i.e. fetched), last accessed, etc. This information is available from filesystem calls for the file in the cache holding the data portion of the URL. Sometimes, some but not all of the information is available in the cached HTTP headers. The PHP code I've wrote is: $URL is the disk-cached, proxied URL to retrieve information about. $QS = (strstr($URL, "?") == FALSE) ? "?" : ""; /* FOOTNOTE */ $parse = get_object_vars(apache_lookup_uri("/cache?".$URL.$QS)); $file = $parse['filename']; $file should be a local filename for a local file, but seems to be "proxy:REMOTE_URL" for all proxied resources. I'd like this to be the file pathname from the local disk cache if such is available. This way, I could report the created, last-modified, and last-accessed times to a user (for statistical purposes). "/cache" is defined in the server configuration file to do a proxied rewrite rule on its QUERY_STRING variable (using "RewriteRule ... [P]") should the appropriate security conditions be met. I've looked at mod_disk_cache.c, and from what I can determine, this line inserted at the end of "open_entity()" should do it (about line 480): + r->filename = apr_pstrdup(r->pool, dobj->datafile); return OK; Of course, one should probably free any prior assignment of "r->filename" else there would be a small memory leak. However, as is, this does not seem to do the requested job. (For locally served files, the true local filename should be used, not the disk cache's filename, but that can be handled by prefixing the code with a conditional - which wasn't necessary for the test.) What am I missing, or what can be done to make this work? ------- Footnote: $QS is necessary, else any QUERY_STRING passed to the PHP script would be inherited by the lookup of the proxied URL. The only way I found to suppress the inheritance was to append a "null query string" to the URL, which should only be done if it lacks its own query string. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
