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

Function ap_proxy_get_worker_ex

modules/proxy/proxy_util.c:1865–1948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1863}
1864
1865PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker_ex(apr_pool_t *p,
1866 proxy_balancer *balancer,
1867 proxy_server_conf *conf,
1868 const char *url,
1869 unsigned int mask)
1870{
1871 proxy_worker *max_worker = NULL;
1872 apr_size_t min_match, max_match = 0;
1873 apr_size_t url_len;
1874 const char *c;
1875 char *url_copy;
1876 int i;
1877
1878 if (!url) {
1879 return NULL;
1880 }
1881
1882 if (!(mask & AP_PROXY_WORKER_NO_UDS)) {
1883 url = ap_proxy_de_socketfy(p, url);
1884 if (!url) {
1885 return NULL;
1886 }
1887 }
1888
1889 c = ap_strchr_c(url, ':');
1890 if (c == NULL || c[1] != '/' || c[2] != '/' || c[3] == '\0') {
1891 return NULL;
1892 }
1893
1894 url_len = strlen(url);
1895 url_copy = apr_pstrmemdup(p, url, url_len);
1896
1897 /* Default to lookup for both _PREFIX and _MATCH workers */
1898 if (!(mask & (AP_PROXY_WORKER_IS_PREFIX | AP_PROXY_WORKER_IS_MATCH))) {
1899 mask |= AP_PROXY_WORKER_IS_PREFIX | AP_PROXY_WORKER_IS_MATCH;
1900 }
1901
1902 /*
1903 * We need to find the start of the path and
1904 * therefore we know the length of the scheme://hostname/
1905 * part to we can force-lowercase everything up to
1906 * the start of the path.
1907 */
1908 c = ap_strchr_c(c+3, '/');
1909 if (c) {
1910 char *pathstart;
1911 pathstart = url_copy + (c - url);
1912 *pathstart = '\0';
1913 ap_str_tolower(url_copy);
1914 min_match = strlen(url_copy);
1915 *pathstart = '/';
1916 }
1917 else {
1918 ap_str_tolower(url_copy);
1919 min_match = strlen(url_copy);
1920 }
1921
1922 /*

Callers 5

add_passFunction · 0.85
set_proxy_paramFunction · 0.85
proxysectionFunction · 0.85
ap_proxy_get_workerFunction · 0.85
ap_proxy_pre_requestFunction · 0.85

Calls 4

ap_proxy_de_socketfyFunction · 0.85
ap_strchr_cFunction · 0.85
ap_str_tolowerFunction · 0.85
worker_matchesFunction · 0.85

Tested by

no test coverage detected