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

Function ap_proxy_is_domainname

modules/proxy/proxy_util.c:675–709  ·  view source on GitHub ↗

Return TRUE if addr represents a domain name */

Source from the content-addressed store, hash-verified

673
674/* Return TRUE if addr represents a domain name */
675PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p)
676{
677 char *addr = This->name;
678 int i;
679
680 /* Domain name must start with a '.' */
681 if (addr[0] != '.') {
682 return 0;
683 }
684
685 /* rfc1035 says DNS names must consist of "[-a-zA-Z0-9]" and '.' */
686 for (i = 0; apr_isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i) {
687 continue;
688 }
689
690#if 0
691 if (addr[i] == ':') {
692 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(03234)
693 "@@@@ handle optional port in proxy_is_domainname()");
694 /* @@@@ handle optional port */
695 }
696#endif
697
698 if (addr[i] != '\0') {
699 return 0;
700 }
701
702 /* Strip trailing dots */
703 for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) {
704 addr[i] = '\0';
705 }
706
707 This->matcher = proxy_match_domainname;
708 return 1;
709}
710
711/* Return TRUE if host "host" is in domain "domain" */
712static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r)

Callers 1

set_proxy_dirconnFunction · 0.85

Calls 1

ap_log_errorFunction · 0.50

Tested by

no test coverage detected