perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Förtsch <>
Subject Apache2::RequestUtil weirdness
Date Fri, 08 Apr 2011 18:17:27 GMT

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,
    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],

        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/ The module contains the following 

<VirtualHost TestProtocol::pseudo_http>

  PerlProcessConnectionHandler TestProtocol::pseudo_http

  <Location TestProtocol::pseudo_http>

      <IfModule @ACCESS_MODULE@>
          Order Deny,Allow
          Allow from @servername@

      <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

#      AuthName TestProtocol::pseudo_http
#      AuthType Basic
      Require user stas
      Satisfy any



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! (

Like fantasy?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message