View | Details | Raw Unified | Return to bug 65429
Collapse All | Expand All

(-)modules/proxy/mod_proxy.c (-3 / +19 lines)
Lines 1888-1895 static const char * Link Here
1888
        new->balancer = balancer;
1888
        new->balancer = balancer;
1889
    }
1889
    }
1890
    else {
1890
    else {
1891
        proxy_worker *worker = ap_proxy_get_worker(cmd->temp_pool, NULL, conf, new->real);
1892
        int reuse = 0;
1891
        int reuse = 0;
1892
        proxy_worker *worker;
1893
        if (use_regex) {
1894
            worker = ap_proxy_get_match_worker(cmd->temp_pool, NULL,
1895
                                               conf, new->real);
1896
        }
1897
        else {
1898
            worker = ap_proxy_get_worker(cmd->temp_pool, NULL,
1899
                                         conf, new->real);
1900
        }
1893
        if (!worker) {
1901
        if (!worker) {
1894
            const char *err;
1902
            const char *err;
1895
            if (use_regex) {
1903
            if (use_regex) {
Lines 2671-2678 static const char *proxysection(cmd_parms *cmd, vo Link Here
2671
            }
2679
            }
2672
        }
2680
        }
2673
        else {
2681
        else {
2674
            worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf,
2682
            if (use_regex) {
2675
                                         ap_proxy_de_socketfy(cmd->temp_pool, (char*)conf->p));
2683
                worker = ap_proxy_get_match_worker(cmd->temp_pool, NULL, sconf,
2684
                                      ap_proxy_de_socketfy(cmd->temp_pool,
2685
                                                           (char*)conf->p));
2686
            }
2687
            else {
2688
                worker = ap_proxy_get_worker(cmd->temp_pool, NULL, sconf,
2689
                                      ap_proxy_de_socketfy(cmd->temp_pool,
2690
                                                           (char*)conf->p));
2691
            }
2676
            if (!worker) {
2692
            if (!worker) {
2677
                if (use_regex) {
2693
                if (use_regex) {
2678
                    err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL,
2694
                    err = ap_proxy_define_match_worker(cmd->pool, &worker, NULL,
(-)modules/proxy/mod_proxy.h (+13 lines)
Lines 754-760 PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker( Link Here
754
                                                  proxy_balancer *balancer,
754
                                                  proxy_balancer *balancer,
755
                                                  proxy_server_conf *conf,
755
                                                  proxy_server_conf *conf,
756
                                                  const char *url);
756
                                                  const char *url);
757
757
/**
758
/**
759
 * Get the matchable worker from proxy configuration
760
 * @param p        memory pool used for finding worker
761
 * @param balancer the balancer that the worker belongs to
762
 * @param conf     current proxy server configuration
763
 * @param url      url to find the worker from
764
 * @return         proxy_worker or NULL if not found
765
 */
766
PROXY_DECLARE(proxy_worker *) ap_proxy_get_match_worker(apr_pool_t *p,
767
                                                  proxy_balancer *balancer,
768
                                                  proxy_server_conf *conf,
769
                                                  const char *url);
770
 /**
758
 * Define and Allocate space for the worker to proxy configuration
771
 * Define and Allocate space for the worker to proxy configuration
759
 * @param p         memory pool to allocate worker from
772
 * @param p         memory pool to allocate worker from
760
 * @param worker    the new worker
773
 * @param worker    the new worker
(-)modules/proxy/proxy_util.c (-12 / +29 lines)
Lines 1720-1729 static int ap_proxy_strcmp_ematch(const char *str, Link Here
1720
    return 0;
1720
    return 0;
1721
}
1721
}
1722
1722
1723
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
1723
static proxy_worker *proxy_get_worker(apr_pool_t *p,
1724
                                                  proxy_balancer *balancer,
1724
                                      proxy_balancer *balancer,
1725
                                                  proxy_server_conf *conf,
1725
                                      proxy_server_conf *conf,
1726
                                                  const char *url)
1726
                                      const char *url,
1727
                                      int matchable)
1727
{
1728
{
1728
    proxy_worker *worker;
1729
    proxy_worker *worker;
1729
    proxy_worker *max_worker = NULL;
1730
    proxy_worker *max_worker = NULL;
Lines 1783-1793 static int ap_proxy_strcmp_ematch(const char *str, Link Here
1783
                && (worker_name_length >= min_match)
1784
                && (worker_name_length >= min_match)
1784
                && (worker_name_length > max_match)
1785
                && (worker_name_length > max_match)
1785
                && (worker->s->is_name_matchable
1786
                && (worker->s->is_name_matchable
1786
                    || strncmp(url_copy, worker->s->name,
1787
                    || (!matchable && strncmp(url_copy, worker->s->name,
1787
                               worker_name_length) == 0)
1788
                                              worker_name_length) == 0))
1788
                && (!worker->s->is_name_matchable
1789
                && (!worker->s->is_name_matchable
1789
                    || ap_proxy_strcmp_ematch(url_copy,
1790
                    || (matchable && ap_proxy_strcmp_ematch(url_copy,
1790
                                              worker->s->name) == 0) ) {
1791
                                              worker->s->name) == 0))) {
1791
                max_worker = worker;
1792
                max_worker = worker;
1792
                max_match = worker_name_length;
1793
                max_match = worker_name_length;
1793
            }
1794
            }
Lines 1799-1809 static int ap_proxy_strcmp_ematch(const char *str, Link Here
1799
                && (worker_name_length >= min_match)
1800
                && (worker_name_length >= min_match)
1800
                && (worker_name_length > max_match)
1801
                && (worker_name_length > max_match)
1801
                && (worker->s->is_name_matchable
1802
                && (worker->s->is_name_matchable
1802
                    || strncmp(url_copy, worker->s->name,
1803
                    || (!matchable && strncmp(url_copy, worker->s->name,
1803
                               worker_name_length) == 0)
1804
                                              worker_name_length) == 0))
1804
                && (!worker->s->is_name_matchable
1805
                && (!worker->s->is_name_matchable
1805
                    || ap_proxy_strcmp_ematch(url_copy,
1806
                    || (matchable && ap_proxy_strcmp_ematch(url_copy,
1806
                                              worker->s->name) == 0) ) {
1807
                                              worker->s->name) == 0))) {
1807
                max_worker = worker;
1808
                max_worker = worker;
1808
                max_match = worker_name_length;
1809
                max_match = worker_name_length;
1809
            }
1810
            }
Lines 1813-1818 static int ap_proxy_strcmp_ematch(const char *str, Link Here
1813
    return max_worker;
1814
    return max_worker;
1814
}
1815
}
1815
1816
1817
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
1818
                                                  proxy_balancer *balancer,
1819
                                                  proxy_server_conf *conf,
1820
                                                  const char *url)
1821
{
1822
    return proxy_get_worker(p, balancer, conf, url, 0);
1823
}
1824
1825
PROXY_DECLARE(proxy_worker *) ap_proxy_get_match_worker(apr_pool_t *p,
1826
                                                  proxy_balancer *balancer,
1827
                                                  proxy_server_conf *conf,
1828
                                                  const char *url)
1829
{
1830
    return proxy_get_worker(p, balancer, conf, url, 1);
1831
}
1832
1816
/*
1833
/*
1817
 * To create a worker from scratch first we define the
1834
 * To create a worker from scratch first we define the
1818
 * specifics of the worker; this is all local data.
1835
 * specifics of the worker; this is all local data.

Return to bug 65429