Hello!
I use:
* Debian GNU/Linux (stretch)
* apache (2.4.25)
* libapr1 (1.5.2)
* https://httpd.apache.org/docs/2.4/developer/modguide.html
Preliminary:
I want to write an apache module.
But first I want a kind of info page.
To see how to use apache, apr, how to get and set data, ..., and
to practice how to programm using C.
So I use (step by step) the elements of struct 'request_rec' to
output the data of each of its elements.
Now, I see that struct 'htaccess_result' contains the elements
'dir', 'override', 'override_opts', 'override_list', 'htaccess'
and 'next'.
For how to use each element I search the apache source code for
useful examples.
But now I am stuck with the element 'override_list'.
The Problem(s):
'override_list' always equals 'NULL'.
The Question(s):
What is necessary to do so 'override_list' doesn't equal 'NULL'?
Do you know of a programming example somewhere online?
My Guess:
I searched the apache source code for an enlightening example but
I haven't found any solution yet.
I guess that at the moment my function 'printApRHtaccess' is
called 'override_list' doesn't contain at this moment any data.
And thus it contains 'NULL',
And I have to do something before 'printApRHtaccess' is called so
'override_list' contains any data.
I haven't found an example online yet.
My function 'printApRHtaccess' is at the moment:
#
# char * string = printApRHtaccess(request, request->htaccess)
#
char * printApRHtaccess(request_rec * request, const struct
htaccess_result * htaccess)
{
struct htaccess_result * cache = NULL;
char * dir = NULL;
int override = 0;
int override_opts = 0;
apr_table_t * override_list = NULL;
struct ap_conf_vector_t * _htaccess = NULL;
char * string = "";
int first = 1;
const apr_array_header_t * fields = NULL;
int count = 0;
apr_table_entry_t * elements = NULL;
int index = 0;
for (cache = (struct htaccess_result *) htaccess; cache != NULL;
cache = (struct htaccess_result *) cache->next)
{
dir = (char *) cache->dir;
override = cache->override;
override_opts = cache->override_opts;
override_list = cache->override_list;
_htaccess = cache->htaccess;
if (NULL != cache)
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "dir = \"%s\"", dir), ", ", NULL);
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "override = \"%i\" (", override), NULL);
first = 1;
if (override & OR_NONE)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_NONE"), NULL);
first = 0;
}
if (override & OR_LIMIT)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_LIMIT"), NULL);
first = 0;
}
if (override & OR_OPTIONS)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_OPTIONS"), NULL);
first = 0;
}
if (override & OR_FILEINFO)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_FILEINFO"), NULL);
first = 0;
}
if (override & OR_AUTHCFG)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_AUTHCFG"), NULL);
first = 0;
}
if (override & OR_INDEXES)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_INDEXES"), NULL);
first = 0;
}
if (override & OR_UNSET)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_UNSET"), NULL);
first = 0;
}
if (override & ACCESS_CONF)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "ACCESS_CONF"), NULL);
first = 0;
}
if (override & RSRC_CONF)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "RSRC_CONF"), NULL);
first = 0;
}
if (override & EXEC_ON_READ)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "EXEC_ON_READ"), NULL);
first = 0;
}
string = apr_pstrcat(request->pool, string, "), ", NULL);
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "override_opts = \"%i\" (", override_opts),
NULL);
first = 1;
if (override_opts & OPT_NONE)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_NONE"), NULL);
first = 0;
}
if (override_opts & OPT_INDEXES)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_INDEXES"), NULL);
first = 0;
}
if (override_opts & OPT_INCLUDES)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_INCLUDES"), NULL);
first = 0;
}
if (override_opts & OPT_SYM_LINKS)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_SYM_LINKS"), NULL);
first = 0;
}
if (override_opts & OPT_EXECCGI)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_EXECCGI"), NULL);
first = 0;
}
if (override_opts & OPT_UNSET)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_UNSET"), NULL);
first = 0;
}
if (override_opts & OPT_INC_WITH_EXEC)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_INC_WITH_EXEC"), NULL);
first = 0;
}
if (override_opts & OPT_SYM_OWNER)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_SYM_OWNER"), NULL);
first = 0;
}
if (override_opts & OPT_MULTI)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_MULTI"), NULL);
first = 0;
}
if (override_opts & OPT_ALL)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_ALL"), NULL);
first = 0;
}
string = apr_pstrcat(request->pool, string, "), ", NULL);
if (NULL != override_list)
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(1:override_list:yes)"), NULL);
apr_table_do(doApRHtaccess, request,
request->htaccess->override_list, NULL);
}
else
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(1:override_list:no)"), NULL);
}
if (NULL != override_list)
//if (! apr_is_empty_table(override_list))
{
fields = apr_table_elts(override_list);
//if (! apr_is_empty_array(fields))
//{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(2:override_list:yes)"), NULL);
count = fields->nelts;
elements = (apr_table_entry_t *) fields->elts;
for (index = 0; index < count; index++)
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "(key=%s/value=%s)", elements[index].key,
elements[index].val), NULL);
}
//}
}
else
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(2:override_list:no)"), NULL);
}
}
}
return string;
}
As output in 'string' I get:
dir = "/var/www/html/mod_ecl/test.ecl/",
override = "31" (OR_LIMIT, OR_OPTIONS, OR_FILEINFO, OR_AUTHCFG, OR_INDEXES),
override_opts = "255" (OPT_INDEXES, OPT_INCLUDES, OPT_SYM_LINKS,
OPT_EXECCGI, OPT_UNSET, OPT_INC_WITH_EXEC, OPT_SYM_OWNER, OPT_MULTI,
OPT_ALL),
(1:override_list:no)
(2:override_list:no)
dir = "/var/www/html/mod_ecl/",
override = "31" (OR_LIMIT, OR_OPTIONS, OR_FILEINFO, OR_AUTHCFG, OR_INDEXES),
override_opts = "255" (OPT_INDEXES, OPT_INCLUDES, OPT_SYM_LINKS,
OPT_EXECCGI, OPT_UNSET, OPT_INC_WITH_EXEC, OPT_SYM_OWNER, OPT_MULTI,
OPT_ALL),
(1:override_list:no)
(2:override_list:no)
In '/etc/apache2/sites-available/default-ssl.conf' is:
# other content above ...
# there is no <Directory /var/www/html/> ... </Directory>
<Directory /var/www/html/mod_ecl/>
AllowOverride ALL
AllowOverrideList Rewrite RewriteEngine RewriteRule RewriteCond
</Directory>
# ... other content below
In '/var/www/html/mod_ecl/.htaccess' I added this to see If there
is any data in 'override_list':
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)\.name-of-domain\.de$ [NC]
RewriteRule ^(.*)$ http://%1.name-of-domai.com/$1 [R=301,L]
There is no '/var/www/html/.htaccess'.
The url is:
https://localhost.localdomain/mod_ecl/test.ecl
Thanks for your help.
Ralf
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
I use:
* Debian GNU/Linux (stretch)
* apache (2.4.25)
* libapr1 (1.5.2)
* https://httpd.apache.org/docs/2.4/developer/modguide.html
Preliminary:
I want to write an apache module.
But first I want a kind of info page.
To see how to use apache, apr, how to get and set data, ..., and
to practice how to programm using C.
So I use (step by step) the elements of struct 'request_rec' to
output the data of each of its elements.
Now, I see that struct 'htaccess_result' contains the elements
'dir', 'override', 'override_opts', 'override_list', 'htaccess'
and 'next'.
For how to use each element I search the apache source code for
useful examples.
But now I am stuck with the element 'override_list'.
The Problem(s):
'override_list' always equals 'NULL'.
The Question(s):
What is necessary to do so 'override_list' doesn't equal 'NULL'?
Do you know of a programming example somewhere online?
My Guess:
I searched the apache source code for an enlightening example but
I haven't found any solution yet.
I guess that at the moment my function 'printApRHtaccess' is
called 'override_list' doesn't contain at this moment any data.
And thus it contains 'NULL',
And I have to do something before 'printApRHtaccess' is called so
'override_list' contains any data.
I haven't found an example online yet.
My function 'printApRHtaccess' is at the moment:
#
# char * string = printApRHtaccess(request, request->htaccess)
#
char * printApRHtaccess(request_rec * request, const struct
htaccess_result * htaccess)
{
struct htaccess_result * cache = NULL;
char * dir = NULL;
int override = 0;
int override_opts = 0;
apr_table_t * override_list = NULL;
struct ap_conf_vector_t * _htaccess = NULL;
char * string = "";
int first = 1;
const apr_array_header_t * fields = NULL;
int count = 0;
apr_table_entry_t * elements = NULL;
int index = 0;
for (cache = (struct htaccess_result *) htaccess; cache != NULL;
cache = (struct htaccess_result *) cache->next)
{
dir = (char *) cache->dir;
override = cache->override;
override_opts = cache->override_opts;
override_list = cache->override_list;
_htaccess = cache->htaccess;
if (NULL != cache)
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "dir = \"%s\"", dir), ", ", NULL);
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "override = \"%i\" (", override), NULL);
first = 1;
if (override & OR_NONE)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_NONE"), NULL);
first = 0;
}
if (override & OR_LIMIT)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_LIMIT"), NULL);
first = 0;
}
if (override & OR_OPTIONS)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_OPTIONS"), NULL);
first = 0;
}
if (override & OR_FILEINFO)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_FILEINFO"), NULL);
first = 0;
}
if (override & OR_AUTHCFG)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_AUTHCFG"), NULL);
first = 0;
}
if (override & OR_INDEXES)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_INDEXES"), NULL);
first = 0;
}
if (override & OR_UNSET)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OR_UNSET"), NULL);
first = 0;
}
if (override & ACCESS_CONF)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "ACCESS_CONF"), NULL);
first = 0;
}
if (override & RSRC_CONF)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "RSRC_CONF"), NULL);
first = 0;
}
if (override & EXEC_ON_READ)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "EXEC_ON_READ"), NULL);
first = 0;
}
string = apr_pstrcat(request->pool, string, "), ", NULL);
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "override_opts = \"%i\" (", override_opts),
NULL);
first = 1;
if (override_opts & OPT_NONE)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_NONE"), NULL);
first = 0;
}
if (override_opts & OPT_INDEXES)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_INDEXES"), NULL);
first = 0;
}
if (override_opts & OPT_INCLUDES)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_INCLUDES"), NULL);
first = 0;
}
if (override_opts & OPT_SYM_LINKS)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_SYM_LINKS"), NULL);
first = 0;
}
if (override_opts & OPT_EXECCGI)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_EXECCGI"), NULL);
first = 0;
}
if (override_opts & OPT_UNSET)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_UNSET"), NULL);
first = 0;
}
if (override_opts & OPT_INC_WITH_EXEC)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_INC_WITH_EXEC"), NULL);
first = 0;
}
if (override_opts & OPT_SYM_OWNER)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_SYM_OWNER"), NULL);
first = 0;
}
if (override_opts & OPT_MULTI)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_MULTI"), NULL);
first = 0;
}
if (override_opts & OPT_ALL)
{
string = apr_pstrcat(request->pool, string, (first) ? "" : ",
", apr_psprintf(request->pool, "%s", "OPT_ALL"), NULL);
first = 0;
}
string = apr_pstrcat(request->pool, string, "), ", NULL);
if (NULL != override_list)
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(1:override_list:yes)"), NULL);
apr_table_do(doApRHtaccess, request,
request->htaccess->override_list, NULL);
}
else
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(1:override_list:no)"), NULL);
}
if (NULL != override_list)
//if (! apr_is_empty_table(override_list))
{
fields = apr_table_elts(override_list);
//if (! apr_is_empty_array(fields))
//{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(2:override_list:yes)"), NULL);
count = fields->nelts;
elements = (apr_table_entry_t *) fields->elts;
for (index = 0; index < count; index++)
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "(key=%s/value=%s)", elements[index].key,
elements[index].val), NULL);
}
//}
}
else
{
string = apr_pstrcat(request->pool, string,
apr_psprintf(request->pool, "%s", "(2:override_list:no)"), NULL);
}
}
}
return string;
}
As output in 'string' I get:
dir = "/var/www/html/mod_ecl/test.ecl/",
override = "31" (OR_LIMIT, OR_OPTIONS, OR_FILEINFO, OR_AUTHCFG, OR_INDEXES),
override_opts = "255" (OPT_INDEXES, OPT_INCLUDES, OPT_SYM_LINKS,
OPT_EXECCGI, OPT_UNSET, OPT_INC_WITH_EXEC, OPT_SYM_OWNER, OPT_MULTI,
OPT_ALL),
(1:override_list:no)
(2:override_list:no)
dir = "/var/www/html/mod_ecl/",
override = "31" (OR_LIMIT, OR_OPTIONS, OR_FILEINFO, OR_AUTHCFG, OR_INDEXES),
override_opts = "255" (OPT_INDEXES, OPT_INCLUDES, OPT_SYM_LINKS,
OPT_EXECCGI, OPT_UNSET, OPT_INC_WITH_EXEC, OPT_SYM_OWNER, OPT_MULTI,
OPT_ALL),
(1:override_list:no)
(2:override_list:no)
In '/etc/apache2/sites-available/default-ssl.conf' is:
# other content above ...
# there is no <Directory /var/www/html/> ... </Directory>
<Directory /var/www/html/mod_ecl/>
AllowOverride ALL
AllowOverrideList Rewrite RewriteEngine RewriteRule RewriteCond
</Directory>
# ... other content below
In '/var/www/html/mod_ecl/.htaccess' I added this to see If there
is any data in 'override_list':
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)\.name-of-domain\.de$ [NC]
RewriteRule ^(.*)$ http://%1.name-of-domai.com/$1 [R=301,L]
There is no '/var/www/html/.htaccess'.
The url is:
https://localhost.localdomain/mod_ecl/test.ecl
Thanks for your help.
Ralf
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org