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

(-)a/modules/proxy/mod_proxy.c (-15 / +42 lines)
Lines 1187-1193 static int proxy_handler(request_rec *r) Link Here
1187
                    access_status = proxy_run_scheme_handler(r, worker,
1187
                    access_status = proxy_run_scheme_handler(r, worker,
1188
                                                             conf, url,
1188
                                                             conf, url,
1189
                                                             ents[i].hostname,
1189
                                                             ents[i].hostname,
1190
                                                             ents[i].port);
1190
                                                             ents[i].port,
1191
                                                             ents[i].auth);
1191
1192
1192
                    /* Did the scheme handler process the request? */
1193
                    /* Did the scheme handler process the request? */
1193
                    if (access_status != DECLINED) {
1194
                    if (access_status != DECLINED) {
Lines 1239-1245 static int proxy_handler(request_rec *r) Link Here
1239
                      scheme, attempts);
1240
                      scheme, attempts);
1240
        AP_PROXY_RUN(r, worker, conf, url, attempts);
1241
        AP_PROXY_RUN(r, worker, conf, url, attempts);
1241
        access_status = proxy_run_scheme_handler(r, worker, conf,
1242
        access_status = proxy_run_scheme_handler(r, worker, conf,
1242
                                                 url, NULL, 0);
1243
                                                 url, NULL, 0, NULL);
1243
        if (access_status == OK
1244
        if (access_status == OK
1244
                || apr_table_get(r->notes, "proxy-error-override"))
1245
                || apr_table_get(r->notes, "proxy-error-override"))
1245
            break;
1246
            break;
Lines 1605-1611 static const char * Link Here
1605
    proxy_server_conf *conf =
1606
    proxy_server_conf *conf =
1606
    (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
1607
    (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
1607
    struct proxy_remote *new;
1608
    struct proxy_remote *new;
1608
    char *p, *q;
1609
    char *p, *q, *a;
1609
    char *r, *f, *scheme;
1610
    char *r, *f, *scheme;
1610
    ap_regex_t *reg = NULL;
1611
    ap_regex_t *reg = NULL;
1611
    int port;
1612
    int port;
Lines 1613-1618 static const char * Link Here
1613
    r = apr_pstrdup(cmd->pool, r1);
1614
    r = apr_pstrdup(cmd->pool, r1);
1614
    scheme = apr_pstrdup(cmd->pool, r1);
1615
    scheme = apr_pstrdup(cmd->pool, r1);
1615
    f = apr_pstrdup(cmd->pool, f1);
1616
    f = apr_pstrdup(cmd->pool, f1);
1617
    /* separate different items from remote proxy server configuration
1618
     *    r = <scheme>://[<auth>@]<host>[:<port>]
1619
     */
1620
    /* separate scheme (must) */
1616
    p = strchr(r, ':');
1621
    p = strchr(r, ':');
1617
    if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') {
1622
    if (p == NULL || p[1] != '/' || p[2] != '/' || p[3] == '\0') {
1618
        if (regex)
1623
        if (regex)
Lines 1621-1629 static const char * Link Here
1621
            return "ProxyRemote: Bad syntax for a remote proxy server";
1626
            return "ProxyRemote: Bad syntax for a remote proxy server";
1622
    }
1627
    }
1623
    else {
1628
    else {
1624
        scheme[p-r] = 0;
1629
        scheme[p-r] = '\0';
1630
    }
1631
    *p = '\0';   /* terminate r (scheme) */
1632
    p+=3;
1633
    /* separate authentication string (optional, default = NULL) */
1634
    q = strchr(p, '@');
1635
    if (q != NULL) {
1636
        *q = '\0';
1637
        /* missing: syntax check of the auth string
1638
         *     but do we really need this?
1639
         */
1640
        a = ap_pbase64encode(cmd->pool, p);
1641
        p = q;
1642
        p+=1;
1643
    }
1644
    else {
1645
        a = NULL;
1625
    }
1646
    }
1626
    q = strchr(p + 3, ':');
1647
    /* separate port (optional, default = default port of scheme) */
1648
    q = strchr(p, ':');
1627
    if (q != NULL) {
1649
    if (q != NULL) {
1628
        if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) {
1650
        if (sscanf(q + 1, "%u", &port) != 1 || port > 65535) {
1629
            if (regex)
1651
            if (regex)
Lines 1633-1650 static const char * Link Here
1633
        }
1655
        }
1634
        *q = '\0';
1656
        *q = '\0';
1635
    }
1657
    }
1636
    else
1658
    else {
1637
        port = -1;
1659
        port = -1;
1638
    *p = '\0';
1660
    }
1661
1639
    if (regex) {
1662
    if (regex) {
1640
        reg = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
1663
        reg = ap_pregcomp(cmd->pool, f, AP_REG_EXTENDED);
1641
        if (!reg)
1664
        if (!reg)
1642
            return "Regular expression for ProxyRemoteMatch could not be compiled.";
1665
            return "Regular expression for ProxyRemoteMatch could not be compiled.";
1643
    }
1666
    }
1644
    else
1667
    else 
1645
        if (strchr(f, ':') == NULL)
1668
        if (strchr(f, ':') == NULL) {
1646
            ap_str_tolower(f);      /* lowercase scheme */
1669
            ap_str_tolower(f);   /* lowercase scheme */
1647
    ap_str_tolower(p + 3);      /* lowercase hostname */
1670
    }
1671
    ap_str_tolower(p);       /* lowercase hostname */
1648
1672
1649
    if (port == -1) {
1673
    if (port == -1) {
1650
        port = apr_uri_port_of_scheme(scheme);
1674
        port = apr_uri_port_of_scheme(scheme);
Lines 1653-1660 static const char * Link Here
1653
    new = apr_array_push(conf->proxies);
1677
    new = apr_array_push(conf->proxies);
1654
    new->scheme = f;
1678
    new->scheme = f;
1655
    new->protocol = r;
1679
    new->protocol = r;
1656
    new->hostname = p + 3;
1680
    new->hostname = p;
1657
    new->port = port;
1681
    new->port = port;
1682
    new->auth = a;
1658
    new->regexp = reg;
1683
    new->regexp = reg;
1659
    new->use_regex = regex;
1684
    new->use_regex = regex;
1660
    return NULL;
1685
    return NULL;
Lines 2608-2614 static const command_rec proxy_cmds[] = Link Here
2608
    AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF,
2633
    AP_INIT_FLAG("ProxyRequests", set_proxy_req, NULL, RSRC_CONF,
2609
     "on if the true proxy requests should be accepted"),
2634
     "on if the true proxy requests should be accepted"),
2610
    AP_INIT_TAKE2("ProxyRemote", add_proxy_noregex, NULL, RSRC_CONF,
2635
    AP_INIT_TAKE2("ProxyRemote", add_proxy_noregex, NULL, RSRC_CONF,
2611
     "a scheme, partial URL or '*' and a proxy server"),
2636
     "a scheme, partial URL or '*' and a proxy server optional with auth"),
2612
    AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF,
2637
    AP_INIT_TAKE2("ProxyRemoteMatch", add_proxy_regex, NULL, RSRC_CONF,
2613
     "a regex pattern and a proxy server"),
2638
     "a regex pattern and a proxy server"),
2614
    AP_INIT_FLAG("ProxyPassInterpolateEnv", ap_set_flag_slot_char,
2639
    AP_INIT_FLAG("ProxyPassInterpolateEnv", ap_set_flag_slot_char,
Lines 3047-3054 APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, scheme_handler, Link Here
3047
                                     (request_rec *r, proxy_worker *worker,
3072
                                     (request_rec *r, proxy_worker *worker,
3048
                                      proxy_server_conf *conf,
3073
                                      proxy_server_conf *conf,
3049
                                      char *url, const char *proxyhost,
3074
                                      char *url, const char *proxyhost,
3050
                                      apr_port_t proxyport),(r,worker,conf,
3075
                                      apr_port_t proxyport,
3051
                                      url,proxyhost,proxyport),DECLINED)
3076
                                      const char *proxyauth),
3077
                                     (r,worker,conf,
3078
                                      url,proxyhost,proxyport, proxyauth),DECLINED)
3052
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, canon_handler,
3079
APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(proxy, PROXY, int, canon_handler,
3053
                                      (request_rec *r, char *url),(r,
3080
                                      (request_rec *r, char *url),(r,
3054
                                      url),DECLINED)
3081
                                      url),DECLINED)
(-)a/modules/proxy/mod_proxy.h (-1 / +6 lines)
Lines 115-120 struct proxy_remote { Link Here
115
    const char *scheme;     /* the schemes handled by this proxy, or '*' */
115
    const char *scheme;     /* the schemes handled by this proxy, or '*' */
116
    const char *protocol;   /* the scheme used to talk to this proxy */
116
    const char *protocol;   /* the scheme used to talk to this proxy */
117
    const char *hostname;   /* the hostname of this proxy */
117
    const char *hostname;   /* the hostname of this proxy */
118
    const char *auth;       /* base64encode(<proxyuser>:<proxypasswd>) */
118
    ap_regex_t *regexp;     /* compiled regex (if any) for the remote */
119
    ap_regex_t *regexp;     /* compiled regex (if any) for the remote */
119
    int use_regex;          /* simple boolean. True if we have a regex pattern */
120
    int use_regex;          /* simple boolean. True if we have a regex pattern */
120
    apr_port_t  port;       /* the port for this proxy */
121
    apr_port_t  port;       /* the port for this proxy */
Lines 595-601 APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, section_post_config, Link Here
595
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler,
596
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, scheme_handler,
596
                          (request_rec *r, proxy_worker *worker,
597
                          (request_rec *r, proxy_worker *worker,
597
                           proxy_server_conf *conf, char *url,
598
                           proxy_server_conf *conf, char *url,
598
                           const char *proxyhost, apr_port_t proxyport))
599
                           const char *proxyhost, apr_port_t proxyport,
600
                           const char *proxyauth))
601
599
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler,
602
APR_DECLARE_EXTERNAL_HOOK(proxy, PROXY, int, canon_handler,
600
                          (request_rec *r, char *url))
603
                          (request_rec *r, char *url))
601
604
Lines 892-897 PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker, Link Here
892
 * @param url     request url
895
 * @param url     request url
893
 * @param proxyname are we connecting directly or via a proxy
896
 * @param proxyname are we connecting directly or via a proxy
894
 * @param proxyport proxy host port
897
 * @param proxyport proxy host port
898
 * @param proxyauth proxy authentication
895
 * @param server_portstr Via headers server port, must be non-NULL
899
 * @param server_portstr Via headers server port, must be non-NULL
896
 * @param server_portstr_size size of the server_portstr buffer; must
900
 * @param server_portstr_size size of the server_portstr buffer; must
897
 * be at least one, even if the protocol doesn't use this
901
 * be at least one, even if the protocol doesn't use this
Lines 905-910 PROXY_DECLARE(int) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, Link Here
905
                                                 char **url,
909
                                                 char **url,
906
                                                 const char *proxyname,
910
                                                 const char *proxyname,
907
                                                 apr_port_t proxyport,
911
                                                 apr_port_t proxyport,
912
                                                 const char *proxyauth,
908
                                                 char *server_portstr,
913
                                                 char *server_portstr,
909
                                                 int server_portstr_size);
914
                                                 int server_portstr_size);
910
915
(-)a/modules/proxy/mod_proxy_ajp.c (-2 / +4 lines)
Lines 721-727 static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, Link Here
721
static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
721
static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
722
                             proxy_server_conf *conf,
722
                             proxy_server_conf *conf,
723
                             char *url, const char *proxyname,
723
                             char *url, const char *proxyname,
724
                             apr_port_t proxyport)
724
                             apr_port_t proxyport,
725
                             const char *proxyauth)
725
{
726
{
726
    int status;
727
    int status;
727
    char server_portstr[32];
728
    char server_portstr[32];
Lines 761-767 static int proxy_ajp_handler(request_rec *r, proxy_worker *worker, Link Here
761
        char *locurl = url;
762
        char *locurl = url;
762
        /* Step One: Determine Who To Connect To */
763
        /* Step One: Determine Who To Connect To */
763
        status = ap_proxy_determine_connection(p, r, conf, worker, backend,
764
        status = ap_proxy_determine_connection(p, r, conf, worker, backend,
764
                                               uri, &locurl, proxyname, proxyport,
765
                                               uri, &locurl, 
766
                                               proxyname, proxyport, proxyauth,
765
                                               server_portstr,
767
                                               server_portstr,
766
                                               sizeof(server_portstr));
768
                                               sizeof(server_portstr));
767
769
(-)a/modules/proxy/mod_proxy_connect.c (-1 / +9 lines)
Lines 147-153 static int proxy_connect_canon(request_rec *r, char *url) Link Here
147
static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
147
static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
148
                                 proxy_server_conf *conf,
148
                                 proxy_server_conf *conf,
149
                                 char *url, const char *proxyname,
149
                                 char *url, const char *proxyname,
150
                                 apr_port_t proxyport)
150
                                 apr_port_t proxyport,
151
                                 const char *proxyauth)
151
{
152
{
152
    connect_conf *c_conf =
153
    connect_conf *c_conf =
153
        ap_get_module_config(r->server->module_config, &proxy_connect_module);
154
        ap_get_module_config(r->server->module_config, &proxy_connect_module);
Lines 328-333 static int proxy_connect_handler(request_rec *r, proxy_worker *worker, Link Here
328
                      "sending the CONNECT request to the remote proxy");
329
                      "sending the CONNECT request to the remote proxy");
329
        ap_fprintf(backconn->output_filters, bb_back,
330
        ap_fprintf(backconn->output_filters, bb_back,
330
                   "CONNECT %s HTTP/1.0" CRLF, r->uri);
331
                   "CONNECT %s HTTP/1.0" CRLF, r->uri);
332
        /* add Proxyauth Header if configured
333
         */
334
        if (proxyauth) {
335
            ap_fprintf(backconn->output_filters, bb_back,
336
                       "Proxy-Authorization: Basic %s" CRLF,
337
                       proxyauth);
338
        }
331
        ap_fprintf(backconn->output_filters, bb_back,
339
        ap_fprintf(backconn->output_filters, bb_back,
332
                   "Proxy-agent: %s" CRLF CRLF, ap_get_server_banner());
340
                   "Proxy-agent: %s" CRLF CRLF, ap_get_server_banner());
333
        ap_fflush(backconn->output_filters, bb_back);
341
        ap_fflush(backconn->output_filters, bb_back);
(-)a/modules/proxy/mod_proxy_fcgi.c (-2 / +4 lines)
Lines 1002-1008 static int fcgi_do_request(apr_pool_t *p, request_rec *r, Link Here
1002
static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
1002
static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
1003
                              proxy_server_conf *conf,
1003
                              proxy_server_conf *conf,
1004
                              char *url, const char *proxyname,
1004
                              char *url, const char *proxyname,
1005
                              apr_port_t proxyport)
1005
                              apr_port_t proxyport,
1006
                              const char *proxyauth)
1006
{
1007
{
1007
    int status;
1008
    int status;
1008
    char server_portstr[32];
1009
    char server_portstr[32];
Lines 1043-1049 static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker, Link Here
1043
    /* Step One: Determine Who To Connect To */
1044
    /* Step One: Determine Who To Connect To */
1044
    uri = apr_palloc(p, sizeof(*uri));
1045
    uri = apr_palloc(p, sizeof(*uri));
1045
    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
1046
    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
1046
                                           uri, &url, proxyname, proxyport,
1047
                                           uri, &url, 
1048
                                           proxyname, proxyport, proxyauth,
1047
                                           server_portstr,
1049
                                           server_portstr,
1048
                                           sizeof(server_portstr));
1050
                                           sizeof(server_portstr));
1049
    if (status != OK) {
1051
    if (status != OK) {
(-)a/modules/proxy/mod_proxy_fdpass.c (-1 / +2 lines)
Lines 123-129 static apr_status_t send_socket(apr_pool_t *p, Link Here
123
static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
123
static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
124
                              proxy_server_conf *conf,
124
                              proxy_server_conf *conf,
125
                              char *url, const char *proxyname,
125
                              char *url, const char *proxyname,
126
                              apr_port_t proxyport)
126
                              apr_port_t proxyport,
127
                              const char *proxyauth)
127
{
128
{
128
    apr_status_t rv;
129
    apr_status_t rv;
129
    apr_socket_t *sock;
130
    apr_socket_t *sock;
(-)a/modules/proxy/mod_proxy_ftp.c (-1 / +2 lines)
Lines 959-965 int ftp_proxyerror(request_rec *r, proxy_conn_rec *conn, int statuscode, const c Link Here
959
 */
959
 */
960
static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
960
static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
961
                             proxy_server_conf *conf, char *url,
961
                             proxy_server_conf *conf, char *url,
962
                             const char *proxyhost, apr_port_t proxyport)
962
                             const char *proxyhost, apr_port_t proxyport,
963
                             const char *proxyauth)
963
{
964
{
964
    apr_pool_t *p = r->pool;
965
    apr_pool_t *p = r->pool;
965
    conn_rec *c = r->connection;
966
    conn_rec *c = r->connection;
(-)a/modules/proxy/mod_proxy_http.c (-4 / +15 lines)
Lines 649-655 int ap_proxy_http_request(apr_pool_t *p, request_rec *r, Link Here
649
                                   proxy_conn_rec *p_conn, proxy_worker *worker,
649
                                   proxy_conn_rec *p_conn, proxy_worker *worker,
650
                                   proxy_server_conf *conf,
650
                                   proxy_server_conf *conf,
651
                                   apr_uri_t *uri,
651
                                   apr_uri_t *uri,
652
                                   char *url, char *server_portstr)
652
                                   char *url, char *server_portstr,
653
                                   const char *proxyauth) 
653
{
654
{
654
    conn_rec *c = r->connection;
655
    conn_rec *c = r->connection;
655
    apr_bucket_alloc_t *bucket_alloc = c->bucket_alloc;
656
    apr_bucket_alloc_t *bucket_alloc = c->bucket_alloc;
Lines 685-690 int ap_proxy_http_request(apr_pool_t *p, request_rec *r, Link Here
685
        return rv;
686
        return rv;
686
    }
687
    }
687
688
689
    if (proxyauth) {
690
        buf = apr_pstrcat(p, "Proxy-Authorization: Basic ",
691
                          proxyauth, CRLF, NULL);
692
        ap_xlate_proto_to_ascii(buf, strlen(buf));
693
        e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
694
        APR_BRIGADE_INSERT_TAIL(header_brigade, e);
695
    } 
696
688
    /* We have headers, let's figure out our request body... */
697
    /* We have headers, let's figure out our request body... */
689
    input_brigade = apr_brigade_create(p, bucket_alloc);
698
    input_brigade = apr_brigade_create(p, bucket_alloc);
690
699
Lines 1852-1858 apr_status_t ap_proxy_http_cleanup(const char *scheme, request_rec *r, Link Here
1852
static int proxy_http_handler(request_rec *r, proxy_worker *worker,
1861
static int proxy_http_handler(request_rec *r, proxy_worker *worker,
1853
                              proxy_server_conf *conf,
1862
                              proxy_server_conf *conf,
1854
                              char *url, const char *proxyname,
1863
                              char *url, const char *proxyname,
1855
                              apr_port_t proxyport)
1864
                              apr_port_t proxyport, const char *proxyauth)
1856
{
1865
{
1857
    int status;
1866
    int status;
1858
    char server_portstr[32];
1867
    char server_portstr[32];
Lines 1930-1936 static int proxy_http_handler(request_rec *r, proxy_worker *worker, Link Here
1930
        /* Step One: Determine Who To Connect To */
1939
        /* Step One: Determine Who To Connect To */
1931
        if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
1940
        if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
1932
                                                uri, &locurl, proxyname,
1941
                                                uri, &locurl, proxyname,
1933
                                                proxyport, server_portstr,
1942
                                                proxyport, proxyauth, server_portstr,
1934
                                                sizeof(server_portstr))) != OK)
1943
                                                sizeof(server_portstr))) != OK)
1935
            break;
1944
            break;
1936
1945
Lines 1963-1974 static int proxy_http_handler(request_rec *r, proxy_worker *worker, Link Here
1963
            }
1972
            }
1964
        }
1973
        }
1965
1974
1975
1966
        /* Step Four: Send the Request
1976
        /* Step Four: Send the Request
1967
         * On the off-chance that we forced a 100-Continue as a
1977
         * On the off-chance that we forced a 100-Continue as a
1968
         * kinda HTTP ping test, allow for retries
1978
         * kinda HTTP ping test, allow for retries
1969
         */
1979
         */
1970
        if ((status = ap_proxy_http_request(p, r, backend, worker,
1980
        if ((status = ap_proxy_http_request(p, r, backend, worker,
1971
                                        conf, uri, locurl, server_portstr)) != OK) {
1981
                                        conf, uri, locurl, server_portstr, 
1982
                                        (is_ssl ? NULL : proxyauth))) != OK) {
1972
            if ((status == HTTP_SERVICE_UNAVAILABLE) && worker->s->ping_timeout_set) {
1983
            if ((status == HTTP_SERVICE_UNAVAILABLE) && worker->s->ping_timeout_set) {
1973
                backend->close = 1;
1984
                backend->close = 1;
1974
                ap_log_rerror(APLOG_MARK, APLOG_INFO, status, r, APLOGNO(01115)
1985
                ap_log_rerror(APLOG_MARK, APLOG_INFO, status, r, APLOGNO(01115)
(-)a/modules/proxy/mod_proxy_scgi.c (-2 / +4 lines)
Lines 525-531 static int scgi_request_status(int *status, request_rec *r) Link Here
525
 */
525
 */
526
static int scgi_handler(request_rec *r, proxy_worker *worker,
526
static int scgi_handler(request_rec *r, proxy_worker *worker,
527
                        proxy_server_conf *conf, char *url,
527
                        proxy_server_conf *conf, char *url,
528
                        const char *proxyname, apr_port_t proxyport)
528
                        const char *proxyname, apr_port_t proxyport,
529
                        const char *proxyauth)
529
{
530
{
530
    int status;
531
    int status;
531
    proxy_conn_rec *backend = NULL;
532
    proxy_conn_rec *backend = NULL;
Lines 550-556 static int scgi_handler(request_rec *r, proxy_worker *worker, Link Here
550
    /* Step One: Determine Who To Connect To */
551
    /* Step One: Determine Who To Connect To */
551
    uri = apr_palloc(p, sizeof(*uri));
552
    uri = apr_palloc(p, sizeof(*uri));
552
    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
553
    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
553
                                           uri, &url, proxyname, proxyport,
554
                                           uri, &url, 
555
                                           proxyname, proxyport, proxyauth,
554
                                           &dummy, 1);
556
                                           &dummy, 1);
555
    if (status != OK) {
557
    if (status != OK) {
556
        goto cleanup;
558
        goto cleanup;
(-)a/modules/proxy/mod_proxy_uwsgi.c (-2 / +3 lines)
Lines 443-449 static int uwsgi_response(request_rec *r, proxy_conn_rec * backend, Link Here
443
443
444
static int uwsgi_handler(request_rec *r, proxy_worker * worker,
444
static int uwsgi_handler(request_rec *r, proxy_worker * worker,
445
                         proxy_server_conf * conf, char *url,
445
                         proxy_server_conf * conf, char *url,
446
                         const char *proxyname, apr_port_t proxyport)
446
                         const char *proxyname, apr_port_t proxyport,
447
                         const char *proxyauth)
447
{
448
{
448
    int status;
449
    int status;
449
    int delta = 0;
450
    int delta = 0;
Lines 492-498 static int uwsgi_handler(request_rec *r, proxy_worker * worker, Link Here
492
    /* Step One: Determine Who To Connect To */
493
    /* Step One: Determine Who To Connect To */
493
    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
494
    status = ap_proxy_determine_connection(p, r, conf, worker, backend,
494
                                           uri, &url, proxyname, proxyport,
495
                                           uri, &url, proxyname, proxyport,
495
                                           server_portstr,
496
                                           proxyauth, server_portstr,
496
                                           sizeof(server_portstr));
497
                                           sizeof(server_portstr));
497
    if (status != OK) {
498
    if (status != OK) {
498
        goto cleanup;
499
        goto cleanup;
(-)a/modules/proxy/mod_proxy_wstunnel.c (-2 / +4 lines)
Lines 278-284 static int proxy_wstunnel_request(apr_pool_t *p, request_rec *r, Link Here
278
static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
278
static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
279
                             proxy_server_conf *conf,
279
                             proxy_server_conf *conf,
280
                             char *url, const char *proxyname,
280
                             char *url, const char *proxyname,
281
                             apr_port_t proxyport)
281
                             apr_port_t proxyport,
282
                             const char *proxyauth)
282
{
283
{
283
    int status;
284
    int status;
284
    char server_portstr[32];
285
    char server_portstr[32];
Lines 336-342 static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker, Link Here
336
        char *locurl = url;
337
        char *locurl = url;
337
        /* Step One: Determine Who To Connect To */
338
        /* Step One: Determine Who To Connect To */
338
        status = ap_proxy_determine_connection(p, r, conf, worker, backend,
339
        status = ap_proxy_determine_connection(p, r, conf, worker, backend,
339
                                               uri, &locurl, proxyname, proxyport,
340
                                               uri, &locurl, 
341
                                               proxyname, proxyport, proxyauth,
340
                                               server_portstr,
342
                                               server_portstr,
341
                                               sizeof(server_portstr));
343
                                               sizeof(server_portstr));
342
344
(-)a/modules/proxy/proxy_util.c (-5 / +16 lines)
Lines 2189-2194 ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, Link Here
2189
                              char **url,
2189
                              char **url,
2190
                              const char *proxyname,
2190
                              const char *proxyname,
2191
                              apr_port_t proxyport,
2191
                              apr_port_t proxyport,
2192
                              const char *proxyauth,
2192
                              char *server_portstr,
2193
                              char *server_portstr,
2193
                              int server_portstr_size)
2194
                              int server_portstr_size)
2194
{
2195
{
Lines 2301-2307 ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, Link Here
2301
                        proxy_auth[0] != '\0' &&
2302
                        proxy_auth[0] != '\0' &&
2302
                        r->user == NULL && /* we haven't yet authenticated */
2303
                        r->user == NULL && /* we haven't yet authenticated */
2303
                        apr_table_get(r->subprocess_env, "Proxy-Chain-Auth")) {
2304
                        apr_table_get(r->subprocess_env, "Proxy-Chain-Auth")) {
2305
                        /* take ProxyAuth from Request */
2304
                        forward->proxy_auth = apr_pstrdup(conn->pool, proxy_auth);
2306
                        forward->proxy_auth = apr_pstrdup(conn->pool, proxy_auth);
2307
                    } else if ( proxyauth ) {
2308
                        /* take ProxyAuth from ProxyRemote */
2309
                        forward->proxy_auth = apr_pstrcat(conn->pool, "Basic ", proxyauth, NULL);
2305
                    }
2310
                    }
2306
                }
2311
                }
2307
            }
2312
            }
Lines 2513-2523 static apr_status_t send_http_connect(proxy_conn_rec *backend, Link Here
2513
    forward_info *forward = (forward_info *)backend->forward;
2518
    forward_info *forward = (forward_info *)backend->forward;
2514
    int len = 0;
2519
    int len = 0;
2515
2520
2516
    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00948)
2517
                 "CONNECT: sending the CONNECT request for %s:%d "
2518
                 "to the remote proxy %pI (%s)",
2519
                 forward->target_host, forward->target_port,
2520
                 backend->addr, backend->hostname);
2521
    /* Create the CONNECT request */
2521
    /* Create the CONNECT request */
2522
    nbytes = apr_snprintf(buffer, sizeof(buffer),
2522
    nbytes = apr_snprintf(buffer, sizeof(buffer),
2523
                          "CONNECT %s:%d HTTP/1.0" CRLF,
2523
                          "CONNECT %s:%d HTTP/1.0" CRLF,
Lines 2527-2532 static apr_status_t send_http_connect(proxy_conn_rec *backend, Link Here
2527
        nbytes += apr_snprintf(buffer + nbytes, sizeof(buffer) - nbytes,
2527
        nbytes += apr_snprintf(buffer + nbytes, sizeof(buffer) - nbytes,
2528
                               "Proxy-Authorization: %s" CRLF,
2528
                               "Proxy-Authorization: %s" CRLF,
2529
                               forward->proxy_auth);
2529
                               forward->proxy_auth);
2530
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00948)
2531
                     "CONNECT: sending the CONNECT request for %s:%d "
2532
                     "to the remote proxy %pI (%s) with forward auth \"%s\"",
2533
                     forward->target_host, forward->target_port,
2534
                     backend->addr, backend->hostname, forward->proxy_auth);
2535
    } else {
2536
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00948)
2537
                     "CONNECT: sending the CONNECT request for %s:%d "
2538
                     "to the remote proxy %pI (%s) without auth",
2539
                     forward->target_host, forward->target_port,
2540
                     backend->addr, backend->hostname);
2530
    }
2541
    }
2531
    /* Set a reasonable agent and send everything */
2542
    /* Set a reasonable agent and send everything */
2532
    nbytes += apr_snprintf(buffer + nbytes, sizeof(buffer) - nbytes,
2543
    nbytes += apr_snprintf(buffer + nbytes, sizeof(buffer) - nbytes,

Return to bug 37355