return 1 if host matches ServerName or ServerAliases */
| 911 | |
| 912 | /* return 1 if host matches ServerName or ServerAliases */ |
| 913 | static int matches_aliases(server_rec *s, const char *host) |
| 914 | { |
| 915 | int i; |
| 916 | apr_array_header_t *names; |
| 917 | |
| 918 | /* match ServerName */ |
| 919 | if (!strcasecmp(host, s->server_hostname)) { |
| 920 | return 1; |
| 921 | } |
| 922 | |
| 923 | /* search all the aliases from ServerAlias directive */ |
| 924 | names = s->names; |
| 925 | if (names) { |
| 926 | char **name = (char **) names->elts; |
| 927 | for (i = 0; i < names->nelts; ++i) { |
| 928 | if (!name[i]) continue; |
| 929 | if (!strcasecmp(host, name[i])) |
| 930 | return 1; |
| 931 | } |
| 932 | } |
| 933 | names = s->wild_names; |
| 934 | if (names) { |
| 935 | char **name = (char **) names->elts; |
| 936 | for (i = 0; i < names->nelts; ++i) { |
| 937 | if (!name[i]) continue; |
| 938 | if (!ap_strcasecmp_match(host, name[i])) |
| 939 | return 1; |
| 940 | } |
| 941 | } |
| 942 | return 0; |
| 943 | } |
| 944 | |
| 945 | |
| 946 | /* Suppose a request came in on the same socket as this r, and included |
no test coverage detected