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

(-)include/http_core.h (+13 lines)
Lines 465-470 Link Here
465
/* This is the default value used */
465
/* This is the default value used */
466
#define ETAG_BACKWARD (ETAG_MTIME | ETAG_SIZE)
466
#define ETAG_BACKWARD (ETAG_MTIME | ETAG_SIZE)
467
467
468
/* Generic ON/OFF/UNSET for unsigned int foo :2 */
469
#define AP_CORE_CONFIG_OFF   (0)
470
#define AP_CORE_CONFIG_ON    (1)
471
#define AP_CORE_CONFIG_UNSET (2)
472
473
/* Generic merge of flag */
474
#define AP_CORE_MERGE_FLAG(field, to, base, over) to->field = \
475
               over->field != AP_CORE_CONFIG_UNSET            \
476
               ? over->field                                  \
477
               : base->field                                   
478
468
/**
479
/**
469
 * @brief Server Signature Enumeration
480
 * @brief Server Signature Enumeration
470
 */
481
 */
Lines 630-635 Link Here
630
     * advice
641
     * advice
631
     */
642
     */
632
    unsigned int cgi_pass_auth : 2;
643
    unsigned int cgi_pass_auth : 2;
644
    unsigned int qualify_redirect_url :2;
645
633
} core_dir_config;
646
} core_dir_config;
634
647
635
/* macro to implement off by default behaviour */
648
/* macro to implement off by default behaviour */
(-)server/core.c (+16 lines)
Lines 191-196 Link Here
191
    conf->max_reversals = AP_MAXRANGES_UNSET;
191
    conf->max_reversals = AP_MAXRANGES_UNSET;
192
192
193
    conf->cgi_pass_auth = AP_CGI_PASS_AUTH_UNSET;
193
    conf->cgi_pass_auth = AP_CGI_PASS_AUTH_UNSET;
194
    conf->qualify_redirect_url = AP_CORE_CONFIG_UNSET; 
194
195
195
    return (void *)conf;
196
    return (void *)conf;
196
}
197
}
Lines 405-410 Link Here
405
406
406
    conf->cgi_pass_auth = new->cgi_pass_auth != AP_CGI_PASS_AUTH_UNSET ? new->cgi_pass_auth : base->cgi_pass_auth;
407
    conf->cgi_pass_auth = new->cgi_pass_auth != AP_CGI_PASS_AUTH_UNSET ? new->cgi_pass_auth : base->cgi_pass_auth;
407
408
409
    AP_CORE_MERGE_FLAG(qualify_redirect_url, conf, base, new);
410
408
    return (void*)conf;
411
    return (void*)conf;
409
}
412
}
410
413
Lines 1707-1712 Link Here
1707
    return NULL;
1710
    return NULL;
1708
}
1711
}
1709
1712
1713
static const char *set_qualify_redirect_url(cmd_parms *cmd, void *d_, int flag)
1714
{
1715
    core_dir_config *d = d_;
1716
1717
    d->qualify_redirect_url = flag ? AP_CORE_CONFIG_ON : AP_CORE_CONFIG_OFF;
1718
1719
    return NULL;
1720
}
1721
1710
static const char *set_override_list(cmd_parms *cmd, void *d_, int argc, char *const argv[])
1722
static const char *set_override_list(cmd_parms *cmd, void *d_, int argc, char *const argv[])
1711
{
1723
{
1712
    core_dir_config *d = d_;
1724
    core_dir_config *d = d_;
Lines 4206-4211 Link Here
4206
AP_INIT_FLAG("CGIPassAuth", set_cgi_pass_auth, NULL, OR_AUTHCFG,
4218
AP_INIT_FLAG("CGIPassAuth", set_cgi_pass_auth, NULL, OR_AUTHCFG,
4207
             "Controls whether HTTP authorization headers, normally hidden, will "
4219
             "Controls whether HTTP authorization headers, normally hidden, will "
4208
             "be passed to scripts"),
4220
             "be passed to scripts"),
4221
AP_INIT_FLAG("QualifyRedirectURL", set_qualify_redirect_url, NULL, OR_FILEINFO,
4222
             "Controls whether HTTP authorization headers, normally hidden, will "
4223
             "be passed to scripts"),
4224
4209
AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower,
4225
AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower,
4210
       (void *)APR_OFFSETOF(core_dir_config, mime_type), OR_FILEINFO,
4226
       (void *)APR_OFFSETOF(core_dir_config, mime_type), OR_FILEINFO,
4211
     "a mime type that overrides other configured type"),
4227
     "a mime type that overrides other configured type"),
(-)server/util_script.c (-12 / +17 lines)
Lines 282-302 Link Here
282
    /* Apache custom error responses. If we have redirected set two new vars */
282
    /* Apache custom error responses. If we have redirected set two new vars */
283
283
284
    if (r->prev) {
284
    if (r->prev) {
285
        /* PR#57785: reconstruct full URL here */
285
        if (conf->qualify_redirect_url != AP_CORE_CONFIG_ON) { 
286
        apr_uri_t *uri = &r->prev->parsed_uri;
286
            add_unless_null(e, "REDIRECT_URL", r->prev->uri);
287
        if (!uri->scheme) {
288
            uri->scheme = (char*)ap_http_scheme(r->prev);
289
        }
287
        }
290
        if (!uri->port) {
288
        else { 
291
            uri->port = ap_get_server_port(r->prev);
289
            /* PR#57785: reconstruct full URL here */
292
            uri->port_str = apr_psprintf(r->pool, "%u", uri->port);
290
            apr_uri_t *uri = &r->prev->parsed_uri;
291
            if (!uri->scheme) {
292
                uri->scheme = (char*)ap_http_scheme(r->prev);
293
            }
294
            if (!uri->port) {
295
                uri->port = ap_get_server_port(r->prev);
296
                uri->port_str = apr_psprintf(r->pool, "%u", uri->port);
297
            }
298
            if (!uri->hostname) {
299
                uri->hostname = (char*)ap_get_server_name_for_url(r->prev);
300
            }
301
            add_unless_null(e, "REDIRECT_URL",
302
                            apr_uri_unparse(r->pool, uri, 0));
293
        }
303
        }
294
        if (!uri->hostname) {
295
            uri->hostname = (char*)ap_get_server_name_for_url(r->prev);
296
        }
297
        add_unless_null(e, "REDIRECT_QUERY_STRING", r->prev->args);
304
        add_unless_null(e, "REDIRECT_QUERY_STRING", r->prev->args);
298
        add_unless_null(e, "REDIRECT_URL",
299
                        apr_uri_unparse(r->pool, uri, 0));
300
    }
305
    }
301
306
302
    if (e != r->subprocess_env) {
307
    if (e != r->subprocess_env) {

Return to bug 204304