Hanno Böck commited on 2015-12-04 08:38:41
Zeige 1 geänderte Dateien mit 123 Einfügungen und 0 Löschungen.
... | ... |
@@ -0,0 +1,123 @@ |
1 |
+diff --git a/include/http_core.h b/include/http_core.h |
|
2 |
+index 6ca53f7..8535455 100644 |
|
3 |
+--- a/include/http_core.h |
|
4 |
++++ b/include/http_core.h |
|
5 |
+@@ -465,6 +465,17 @@ typedef unsigned long etag_components_t; |
|
6 |
+ /* This is the default value used */ |
|
7 |
+ #define ETAG_BACKWARD (ETAG_MTIME | ETAG_SIZE) |
|
8 |
+ |
|
9 |
++/* Generic ON/OFF/UNSET for unsigned int foo :2 */ |
|
10 |
++#define AP_CORE_CONFIG_OFF (0) |
|
11 |
++#define AP_CORE_CONFIG_ON (1) |
|
12 |
++#define AP_CORE_CONFIG_UNSET (2) |
|
13 |
++ |
|
14 |
++/* Generic merge of flag */ |
|
15 |
++#define AP_CORE_MERGE_FLAG(field, to, base, over) to->field = \ |
|
16 |
++ over->field != AP_CORE_CONFIG_UNSET \ |
|
17 |
++ ? over->field \ |
|
18 |
++ : base->field |
|
19 |
++ |
|
20 |
+ /** |
|
21 |
+ * @brief Server Signature Enumeration |
|
22 |
+ */ |
|
23 |
+@@ -630,6 +641,8 @@ typedef struct { |
|
24 |
+ * advice |
|
25 |
+ */ |
|
26 |
+ unsigned int cgi_pass_auth : 2; |
|
27 |
++ unsigned int qualify_redirect_url :2; |
|
28 |
++ |
|
29 |
+ } core_dir_config; |
|
30 |
+ |
|
31 |
+ /* macro to implement off by default behaviour */ |
|
32 |
+diff --git a/server/core.c b/server/core.c |
|
33 |
+index 37484b6..803d4d4 100644 |
|
34 |
+--- a/server/core.c |
|
35 |
++++ b/server/core.c |
|
36 |
+@@ -191,6 +191,7 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir) |
|
37 |
+ conf->max_reversals = AP_MAXRANGES_UNSET; |
|
38 |
+ |
|
39 |
+ conf->cgi_pass_auth = AP_CGI_PASS_AUTH_UNSET; |
|
40 |
++ conf->qualify_redirect_url = AP_CORE_CONFIG_UNSET; |
|
41 |
+ |
|
42 |
+ return (void *)conf; |
|
43 |
+ } |
|
44 |
+@@ -405,6 +406,8 @@ static void *merge_core_dir_configs(apr_pool_t *a, void *basev, void *newv) |
|
45 |
+ |
|
46 |
+ conf->cgi_pass_auth = new->cgi_pass_auth != AP_CGI_PASS_AUTH_UNSET ? new->cgi_pass_auth : base->cgi_pass_auth; |
|
47 |
+ |
|
48 |
++ AP_CORE_MERGE_FLAG(qualify_redirect_url, conf, base, new); |
|
49 |
++ |
|
50 |
+ return (void*)conf; |
|
51 |
+ } |
|
52 |
+ |
|
53 |
+@@ -1707,6 +1710,15 @@ static const char *set_cgi_pass_auth(cmd_parms *cmd, void *d_, int flag) |
|
54 |
+ return NULL; |
|
55 |
+ } |
|
56 |
+ |
|
57 |
++static const char *set_qualify_redirect_url(cmd_parms *cmd, void *d_, int flag) |
|
58 |
++{ |
|
59 |
++ core_dir_config *d = d_; |
|
60 |
++ |
|
61 |
++ d->qualify_redirect_url = flag ? AP_CORE_CONFIG_ON : AP_CORE_CONFIG_OFF; |
|
62 |
++ |
|
63 |
++ return NULL; |
|
64 |
++} |
|
65 |
++ |
|
66 |
+ static const char *set_override_list(cmd_parms *cmd, void *d_, int argc, char *const argv[]) |
|
67 |
+ { |
|
68 |
+ core_dir_config *d = d_; |
|
69 |
+@@ -4206,6 +4218,10 @@ AP_INIT_TAKE12("LimitInternalRecursion", set_recursion_limit, NULL, RSRC_CONF, |
|
70 |
+ AP_INIT_FLAG("CGIPassAuth", set_cgi_pass_auth, NULL, OR_AUTHCFG, |
|
71 |
+ "Controls whether HTTP authorization headers, normally hidden, will " |
|
72 |
+ "be passed to scripts"), |
|
73 |
++AP_INIT_FLAG("QualifyRedirectURL", set_qualify_redirect_url, NULL, OR_FILEINFO, |
|
74 |
++ "Controls whether HTTP authorization headers, normally hidden, will " |
|
75 |
++ "be passed to scripts"), |
|
76 |
++ |
|
77 |
+ AP_INIT_TAKE1("ForceType", ap_set_string_slot_lower, |
|
78 |
+ (void *)APR_OFFSETOF(core_dir_config, mime_type), OR_FILEINFO, |
|
79 |
+ "a mime type that overrides other configured type"), |
|
80 |
+diff --git a/server/util_script.c b/server/util_script.c |
|
81 |
+index 14991cd..7ac7930 100644 |
|
82 |
+--- a/server/util_script.c |
|
83 |
++++ b/server/util_script.c |
|
84 |
+@@ -282,21 +282,26 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r) |
|
85 |
+ /* Apache custom error responses. If we have redirected set two new vars */ |
|
86 |
+ |
|
87 |
+ if (r->prev) { |
|
88 |
+- /* PR#57785: reconstruct full URL here */ |
|
89 |
+- apr_uri_t *uri = &r->prev->parsed_uri; |
|
90 |
+- if (!uri->scheme) { |
|
91 |
+- uri->scheme = (char*)ap_http_scheme(r->prev); |
|
92 |
+- } |
|
93 |
+- if (!uri->port) { |
|
94 |
+- uri->port = ap_get_server_port(r->prev); |
|
95 |
+- uri->port_str = apr_psprintf(r->pool, "%u", uri->port); |
|
96 |
+- } |
|
97 |
+- if (!uri->hostname) { |
|
98 |
+- uri->hostname = (char*)ap_get_server_name_for_url(r->prev); |
|
99 |
++ if (conf->qualify_redirect_url != AP_CORE_CONFIG_ON) { |
|
100 |
++ add_unless_null(e, "REDIRECT_URL", r->prev->uri); |
|
101 |
++ } |
|
102 |
++ else { |
|
103 |
++ /* PR#57785: reconstruct full URL here */ |
|
104 |
++ apr_uri_t *uri = &r->prev->parsed_uri; |
|
105 |
++ if (!uri->scheme) { |
|
106 |
++ uri->scheme = (char*)ap_http_scheme(r->prev); |
|
107 |
++ } |
|
108 |
++ if (!uri->port) { |
|
109 |
++ uri->port = ap_get_server_port(r->prev); |
|
110 |
++ uri->port_str = apr_psprintf(r->pool, "%u", uri->port); |
|
111 |
++ } |
|
112 |
++ if (!uri->hostname) { |
|
113 |
++ uri->hostname = (char*)ap_get_server_name_for_url(r->prev); |
|
114 |
++ } |
|
115 |
++ add_unless_null(e, "REDIRECT_URL", |
|
116 |
++ apr_uri_unparse(r->pool, uri, 0)); |
|
117 |
+ } |
|
118 |
+ add_unless_null(e, "REDIRECT_QUERY_STRING", r->prev->args); |
|
119 |
+- add_unless_null(e, "REDIRECT_URL", |
|
120 |
+- apr_uri_unparse(r->pool, uri, 0)); |
|
121 |
+ } |
|
122 |
+ |
|
123 |
+ if (e != r->subprocess_env) { |
|
0 | 124 |