Commit 228643f8 authored by Mladen Turk's avatar Mladen Turk
Browse files

Move direct_connect out of attempt loop. No need to

calculate that value on each attempt, because it's always
the same.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@160705 13f79535-47bb-0310-9956-ffa450edef68
parent 256103fb
Loading
Loading
Loading
Loading
+27 −36
Original line number Diff line number Diff line
@@ -529,6 +529,7 @@ static int proxy_handler(request_rec *r)
    proxy_balancer *balancer = NULL;
    proxy_worker *worker = NULL;
    int attempts = 0, max_attempts = 0;
    struct dirconn_entry *list = (struct dirconn_entry *)conf->dirconn->elts;

    /* is this for us? */
    if (!r->proxyreq || !r->filename || strncmp(r->filename, "proxy:", 6) != 0)
@@ -572,7 +573,6 @@ static int proxy_handler(request_rec *r)
    apr_table_set(r->headers_in, "Max-Forwards", 
                  apr_psprintf(r->pool, "%ld", (maxfwd > 0) ? maxfwd : 0));

    do {
    url = r->filename + 6;
    p = strchr(url, ':');
    if (p == NULL) {
@@ -588,29 +588,20 @@ static int proxy_handler(request_rec *r)
            return HTTP_MOVED_PERMANENTLY;
    }

        *p = '\0';
        scheme = apr_pstrdup(r->pool, url);
        *p = ':';

    scheme = apr_pstrndup(r->pool, url, p - url);
    /* Check URI's destination host against NoProxy hosts */
    /* Bypass ProxyRemote server lookup if configured as NoProxy */
        /* we only know how to handle communication to a proxy via http */
        /*if (strcasecmp(scheme, "http") == 0) */
        {
            int ii;
            struct dirconn_entry *list = (struct dirconn_entry *)
                                                conf->dirconn->elts;

            for (direct_connect = ii = 0; ii < conf->dirconn->nelts &&
                                               !direct_connect; ii++) {
                direct_connect = list[ii].matcher(&list[ii], r);
    for (direct_connect = i = 0; i < conf->dirconn->nelts &&
                                        !direct_connect; i++) {
        direct_connect = list[i].matcher(&list[i], r);
    }
#if DEBUGGING
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
                (direct_connect) ? "NoProxy for %s" : "UseProxy for %s",
                r->uri);
#endif
        }

    do {

        /* Try to obtain the most suitable worker */
        access_status = ap_proxy_pre_request(&worker, &balancer, r, conf, &url);