Return TRUE if host "host" is equal to host2 "host2" */
| 763 | |
| 764 | /* Return TRUE if host "host" is equal to host2 "host2" */ |
| 765 | static int proxy_match_hostname(struct dirconn_entry *This, request_rec *r) |
| 766 | { |
| 767 | char *host = This->name; |
| 768 | const char *host2 = proxy_get_host_of_request(r); |
| 769 | int h2_len; |
| 770 | int h1_len; |
| 771 | |
| 772 | if (host == NULL || host2 == NULL) { |
| 773 | return 0; /* oops! */ |
| 774 | } |
| 775 | |
| 776 | h2_len = strlen(host2); |
| 777 | h1_len = strlen(host); |
| 778 | |
| 779 | #if 0 |
| 780 | struct apr_sockaddr_t *addr = *This->hostaddr; |
| 781 | |
| 782 | /* Try to deal with multiple IP addr's for a host */ |
| 783 | while (addr) { |
| 784 | if (addr->ipaddr_ptr == ? ? ? ? ? ? ? ? ? ? ? ? ?) |
| 785 | return 1; |
| 786 | addr = addr->next; |
| 787 | } |
| 788 | #endif |
| 789 | |
| 790 | /* Ignore trailing dots in host2 comparison: */ |
| 791 | while (h2_len > 0 && host2[h2_len - 1] == '.') { |
| 792 | --h2_len; |
| 793 | } |
| 794 | while (h1_len > 0 && host[h1_len - 1] == '.') { |
| 795 | --h1_len; |
| 796 | } |
| 797 | return h1_len == h2_len |
| 798 | && strncasecmp(host, host2, h1_len) == 0; |
| 799 | } |
| 800 | |
| 801 | /* Return TRUE if addr is to be matched as a word */ |
| 802 | PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p) |
nothing calls this directly
no test coverage detected