Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Function 'filemod' does not exist |
|
Author |
|
timo
Joined: 03 Jun 2012 Posts: 45 Location: FI, EU
|
Posted: Fri 28 Jan '22 13:05 Post subject: Function 'filemod' does not exist |
|
|
I was testing rewrite with following conditions:
Code: | RewriteCond expr "filesize('%{DOCUMENT_ROOT}/down-for-maintenance.txt') -gt 1024"
RewriteCond expr "filemod('%{DOCUMENT_ROOT}/down-for-maintenance.txt') -gt %{TIME}" |
Result was error 500. Message in error log:
Code: | [2022-01-28 12:25:05.815403] [core:alert] [pid 14784:tid 4548] [client xxxxx] [xxxx/.htaccess: RewriteCond: cannot compile expression "filemod('%{DOCUMENT_ROOT}/down-for-maintenance.txt') -gt %{TIME}": Function 'filemod' does not exist] |
At https://httpd.apache.org/docs/2.4/expr.html there is a description of functions filesize and filemod. Both have Special note of being 'Rescricted', meaning that they are not available in some modules like mod_include.
The filesize function does not create an error, so it is not restricted in my case.
What are restricted modules for the filemod function?
Or is there some other problem that I'm not aware of? |
|
Back to top |
|
timo
Joined: 03 Jun 2012 Posts: 45 Location: FI, EU
|
Posted: Fri 28 Jan '22 13:50 Post subject: |
|
|
I did some digging.
In the source of httpd-2.4.52\server\util_expr_eval.c there is no filemod in
Code: | static const struct expr_provider_single string_func_providers[] = {
{ osenv_func, "osenv", NULL, 0 },
{ env_func, "env", NULL, 0 },
{ req_table_func, "resp", NULL, 0 },
{ req_table_func, "req", NULL, 0 },
/* 'http' as alias for 'req' for compatibility with ssl_expr */
{ req_table_func, "http", NULL, 0 },
{ req_table_func, "note", NULL, 0 },
{ req_table_func, "reqenv", NULL, 0 },
{ req_table_func, "req_novary", NULL, 0 },
{ tolower_func, "tolower", NULL, 0 },
{ toupper_func, "toupper", NULL, 0 },
{ escape_func, "escape", NULL, 0 },
{ unescape_func, "unescape", NULL, 0 },
{ file_func, "file", NULL, 1 },
{ filesize_func, "filesize", NULL, 1 },
{ base64_func, "base64", NULL, 0 },
{ unbase64_func, "unbase64", NULL, 0 },
{ sha1_func, "sha1", NULL, 0 },
{ md5_func, "md5", NULL, 0 },
{ NULL, NULL, NULL}
}; |
So, is it actually missing, although mentioned in version 2.4 Documentation? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
|
|
|
|
|