From: Brian Pane Date: Mon, 2 Sep 2002 01:37:54 +0000 (+0000) Subject: Rearranged the loop in fix_hostname() to run faster in the X-Git-Tag: AGB_BEFORE_AAA_CHANGES~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=679f82a1d2ead37e57150d648dc0d0354f4fbc89;p=apache Rearranged the loop in fix_hostname() to run faster in the common case in which lowercase characters are the most frequent characters in the hostname git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96616 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/vhost.c b/server/vhost.c index 324b305bfe..412c782d2a 100644 --- a/server/vhost.c +++ b/server/vhost.c @@ -777,17 +777,20 @@ static void fix_hostname(request_rec *r) */ if (r->hostname[0] != '[') { for (dst = host; *dst; dst++) { - if (*dst == '.') { + if (apr_islower(*dst)) { + /* leave char unchanged */ + } + else if (*dst == '.') { if (*(dst + 1) == '.') { goto bad; } } + else if (apr_isupper(*dst)) { + *dst = apr_tolower(*dst); + } else if (*dst == '/' || *dst == '\\') { goto bad; } - else if (apr_isalpha(*dst)) { - *dst = apr_tolower(*dst); - } } /* strip trailing gubbins */ if (dst > host && dst[-1] == '.') {