www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Blake Mills <bla...@blakem.com>
Subject mod_rewrite/5638: int:tolower causes internal looping on null input
Date Tue, 25 Jan 2000 04:45:46 GMT

>Number:         5638
>Category:       mod_rewrite
>Synopsis:       int:tolower causes internal looping on null input
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Jan 24 20:50:01 PST 2000
>Originator:     blakem@blakem.com
>Release:        1.3.9
SunOS 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-250
ucbcc: WorkShop Compilers 5.0 98/12/15 C 5.0


Linux 2.0.36
I'm configuring mod_rewrite to handle name based virtual hosting.  This
included the following lines:

RewriteMap   lc            int:tolower
RewriteCond  ${lc:%{HTTP_HOST}}        ^(www\.)?([^.]+)

Which usually worked fine.  However, when HTTP_HOST is not set, httpd hangs
and goes into an infinite loop.
RewriteMap   lc            int:tolower
RewriteCond  ${lc:%{HTTP_HOST}}        ^(www\.)?([^.]+)
RewriteRule  . -
% telnet localhost 80
I can get around this problem by setting an environment variable to HTTP_HOST
or a default value.  This ensures int:tolower wont be called with a null value.
My kludgy workaround looks like:

RewriteMap   lc            int:tolower
RewriteCond %{HTTP_HOST}                (.+)
RewriteCond www.defaultsite.com         (.+)
RewriteRule .                  -        [E=HTTP_VHOST:${lc:%1}]

Then I use %{ENV:HTTP_VHOST} instead of %{HTTP_HOST} elsewhere.

I've looked at the code, and haven't seen any obvious reason why this is happening,
however, I'm taking 1.3.11 for a test drive and will look into it further.
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]

View raw message