MCPcopy Create free account
hub / github.com/apache/httpd / proxy_match_hostname

Function proxy_match_hostname

modules/proxy/proxy_util.c:765–799  ·  view source on GitHub ↗

Return TRUE if host "host" is equal to host2 "host2" */

Source from the content-addressed store, hash-verified

763
764/* Return TRUE if host "host" is equal to host2 "host2" */
765static 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 */
802PROXY_DECLARE(int) ap_proxy_is_word(struct dirconn_entry *This, apr_pool_t *p)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected