PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p)
{
    char *addr = This->name;
    int i;
    if (addr[0] != '.') {
        return 0;
    }
    for (i = 0; apr_isalnum(addr[i]) || addr[i] == '-' || addr[i] == '.'; ++i) {
        continue;
    }
#if 0
    if (addr[i] == ':') {
    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
                     "@@@@ handle optional port in proxy_is_domainname()");
    }
#endif
    if (addr[i] != '\0') {
        return 0;
    }
    for (i = strlen(addr) - 1; i > 0 && addr[i] == '.'; --i) {
        addr[i] = '\0';
    }
    This->matcher = proxy_match_domainname;
    return 1;
}
['static const char *\n    set_proxy_dirconn(cmd_parms *parms, void *dummy, const char *arg)\n{\n    server_rec *s = parms->server;\n    proxy_server_conf *conf =\n    ap_get_module_config(s->module_config, &proxy_module);\n    struct dirconn_entry *New;\n    struct dirconn_entry *list = (struct dirconn_entry *) conf->dirconn->elts;\n    int found = 0;\n    int i;\n    for (i = 0; i < conf->dirconn->nelts; i++) {\n        if (strcasecmp(arg, list[i].name) == 0)\n            found = 1;\n    }\n    if (!found) {\n        New = apr_array_push(conf->dirconn);\n        New->name = apr_pstrdup(parms->pool, arg);\n        New->hostaddr = NULL;\n    if (ap_proxy_is_ipaddr(New, parms->pool)) {\n#if DEBUGGING\n        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,\n                     "Parsed addr %s", inet_ntoa(New->addr));\n        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,\n                     "Parsed mask %s", inet_ntoa(New->mask));\n#endif\n    }\n    else if (ap_proxy_is_domainname(New, parms->pool)) {\n        ap_str_tolower(New->name);\n#if DEBUGGING\n        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,\n                     "Parsed domain %s", New->name);\n#endif\n        }\n        else if (ap_proxy_is_hostname(New, parms->pool)) {\n            ap_str_tolower(New->name);\n#if DEBUGGING\n            ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,\n                         "Parsed host %s", New->name);\n#endif\n        }\n        else {\n            ap_proxy_is_word(New, parms->pool);\n#if DEBUGGING\n            fprintf(stderr, "Parsed word %s\\n", New->name);\n#endif\n        }\n    }\n    return NULL;\n}', 'PROXY_DECLARE(int) ap_proxy_is_ipaddr(struct dirconn_entry *This, apr_pool_t *p)\n{\n    const char *addr = This->name;\n    long ip_addr[4];\n    int i, quads;\n    long bits;\n    for (quads = 0; quads < 4 && *addr != \'\\0\'; ++quads) {\n        char *tmp;\n        if (*addr == \'/\' && quads > 0) {\n            break;\n        }\n        if (!apr_isdigit(*addr)) {\n            return 0;\n        }\n        ip_addr[quads] = strtol(addr, &tmp, 0);\n        if (tmp == addr) {\n            return 0;\n        }\n        if (ip_addr[quads] < 0 || ip_addr[quads] > 255) {\n            return 0;\n        }\n        addr = tmp;\n        if (*addr == \'.\' && quads != 3) {\n            ++addr;\n        }\n    }\n    for (This->addr.s_addr = 0, i = 0; i < quads; ++i) {\n        This->addr.s_addr |= htonl(ip_addr[i] << (24 - 8 * i));\n    }\n    if (addr[0] == \'/\' && apr_isdigit(addr[1])) {\n        char *tmp;\n        ++addr;\n        bits = strtol(addr, &tmp, 0);\n        if (tmp == addr) {\n            return 0;\n        }\n        addr = tmp;\n        if (bits < 0 || bits > 32) {\n            return 0;\n        }\n    }\n    else {\n        while (quads > 0 && ip_addr[quads - 1] == 0) {\n            --quads;\n        }\n        if (quads < 1) {\n            return 0;\n        }\n        bits = 8 * quads;\n        if (bits != 32) {\n            ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00900)\n                         "Warning: NetMask not supplied with IP-Addr; guessing: %s/%ld",\n                         inet_ntoa(This->addr), bits);\n        }\n    }\n    This->mask.s_addr = htonl(APR_INADDR_NONE << (32 - bits));\n    if (*addr == \'\\0\' && (This->addr.s_addr & ~This->mask.s_addr) != 0) {\n        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00901)\n                     "Warning: NetMask and IP-Addr disagree in %s/%ld",\n                     inet_ntoa(This->addr), bits);\n        This->addr.s_addr &= This->mask.s_addr;\n        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00902)\n                     "         Set to %s/%ld", inet_ntoa(This->addr), bits);\n    }\n    if (*addr == \'\\0\') {\n        This->matcher = proxy_match_ipaddr;\n        return 1;\n    }\n    else {\n        return (*addr == \'\\0\');\n    }\n}', 'PROXY_DECLARE(int) ap_proxy_is_domainname(struct dirconn_entry *This, apr_pool_t *p)\n{\n    char *addr = This->name;\n    int i;\n    if (addr[0] != \'.\') {\n        return 0;\n    }\n    for (i = 0; apr_isalnum(addr[i]) || addr[i] == \'-\' || addr[i] == \'.\'; ++i) {\n        continue;\n    }\n#if 0\n    if (addr[i] == \':\') {\n    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,\n                     "@@@@ handle optional port in proxy_is_domainname()");\n    }\n#endif\n    if (addr[i] != \'\\0\') {\n        return 0;\n    }\n    for (i = strlen(addr) - 1; i > 0 && addr[i] == \'.\'; --i) {\n        addr[i] = \'\\0\';\n    }\n    This->matcher = proxy_match_domainname;\n    return 1;\n}']