You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Torsten Förtsch <to...@gmx.net> on 2011/04/08 20:17:27 UTC
Apache2::RequestUtil weirdness
Hi,
I have just stumbled across this function in Apache2::RequestUtil. The
"# if 0" is mine.
Does anybody recall WHY the lines between "# if 0" and "# endif" were put in
in the first place?
I have checked the SVN. They were already present in the very first version of
the file.
static MP_INLINE
int mpxs_Apache2__RequestRec_location_merge(request_rec *r,
char *location)
{
apr_pool_t *p = r->pool;
server_rec *s = r->server;
core_server_config *sconf = ap_get_module_config(s->module_config,
&core_module);
ap_conf_vector_t **sec = (ap_conf_vector_t **)sconf->sec_url->elts;
int num_sec = sconf->sec_url->nelts;
int i;
for (i=0; i<num_sec; i++) {
core_dir_config *entry =
(core_dir_config *)ap_get_module_config(sec[i],
&core_module);
if (strEQ(entry->d, location)) {
# if 0
if (!entry->ap_auth_type) {
entry->ap_auth_type = "Basic";
}
if (!entry->ap_auth_name) {
entry->ap_auth_name = apr_pstrdup(p, location);
}
# endif
r->per_dir_config =
ap_merge_per_dir_configs(p, s->lookup_defaults, sec[i]);
return 1;
}
}
return 0;
}
The relevant test is t/protocol/pseudo_http.t and it's module
t/protocol/TestProtocol/pseudo_http.pm. The module contains the following
config:
<VirtualHost TestProtocol::pseudo_http>
PerlProcessConnectionHandler TestProtocol::pseudo_http
<Location TestProtocol::pseudo_http>
<IfModule @ACCESS_MODULE@>
Order Deny,Allow
Allow from @servername@
</IfModule>
<IfModule @AUTH_MODULE@>
# htpasswd -mbc basic-auth stas foobar
# using md5 password so it'll work on win32 too
AuthUserFile @ServerRoot@/htdocs/protocols/basic-auth
</IfModule>
# AuthName TestProtocol::pseudo_http
# AuthType Basic
Require user stas
Satisfy any
</Location>
</VirtualHost>
Again, the commented out lines (AuthName, AuthType) are mine.
When both sets of lines are inactive the test fails. But I strongly believe
that AuthName and AuthType if they are needed here should be configured in the
Location container and not be hardcoded, even as default values.
I'll remove the lines:
if (!entry->ap_auth_type) {
entry->ap_auth_type = "Basic";
}
if (!entry->ap_auth_name) {
entry->ap_auth_name = apr_pstrdup(p, location);
}
if nobody vetoes.
Torsten Förtsch
--
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Apache2::RequestUtil weirdness
Posted by Fred Moyer <fr...@redhotpenguin.com>.
2011/4/19 Torsten Förtsch <to...@gmx.net>:
> Anyway, the httpd 2.4 port requires a lot of changes in the aaa phases. All
> related stuff has been outsourced from the core module. So, I suggest the
> change not only because I think AuthType and AuthName must not be hard coded
> here but also because I am not sure yet how to support that with httpd 2.4.
Does it make sense to release those as Apache2::AAA or something like
that? Can you move that functionality out of the mp2 core? My
uneducated guess.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Apache2::RequestUtil weirdness
Posted by Torsten Förtsch <to...@gmx.net>.
On Tuesday, April 19, 2011 08:35:25 Fred Moyer wrote:
> Can you post test results for the case where the lines are removed?
All tests successful.
Files=248, Tests=2692, 135 wallclock secs ( 1.51 usr 0.55 sys + 103.27 cusr
11.39 csys = 116.72 CPU)
Result: PASS
And this is the suggested change:
Index: t/protocol/TestProtocol/pseudo_http.pm
===================================================================
--- t/protocol/TestProtocol/pseudo_http.pm (revision 1089430)
+++ t/protocol/TestProtocol/pseudo_http.pm (working copy)
@@ -165,6 +165,8 @@
AuthUserFile @ServerRoot@/htdocs/protocols/basic-auth
</IfModule>
+ AuthName TestProtocol::pseudo_http
+ AuthType Basic
Require user stas
Satisfy any
Index: xs/Apache2/RequestUtil/Apache2__RequestUtil.h
===================================================================
--- xs/Apache2/RequestUtil/Apache2__RequestUtil.h (revision 1089430)
+++ xs/Apache2/RequestUtil/Apache2__RequestUtil.h (working copy)
@@ -154,12 +154,6 @@
&core_module);
if (strEQ(entry->d, location)) {
- if (!entry->ap_auth_type) {
- entry->ap_auth_type = "Basic";
- }
- if (!entry->ap_auth_name) {
- entry->ap_auth_name = apr_pstrdup(p, location);
- }
r->per_dir_config =
ap_merge_per_dir_configs(p, s->lookup_defaults, sec[i]);
return 1;
Anyway, the httpd 2.4 port requires a lot of changes in the aaa phases. All
related stuff has been outsourced from the core module. So, I suggest the
change not only because I think AuthType and AuthName must not be hard coded
here but also because I am not sure yet how to support that with httpd 2.4.
Torsten Förtsch
--
Need professional modperl support? Hire me! (http://foertsch.name)
Like fantasy? http://kabatinte.net
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Apache2::RequestUtil weirdness
Posted by Fred Moyer <fr...@redhotpenguin.com>.
2011/4/8 Torsten Förtsch <to...@gmx.net>:
> I'll remove the lines:
>
> if (!entry->ap_auth_type) {
> entry->ap_auth_type = "Basic";
> }
> if (!entry->ap_auth_name) {
> entry->ap_auth_name = apr_pstrdup(p, location);
> }
>
> if nobody vetoes.
Can you post test results for the case where the lines are removed?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org