/
mdounin_clear-old-Location-header.patch
71 lines (63 loc) · 2.9 KB
/
mdounin_clear-old-Location-header.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Index: nginx-catap/nginx/src/http/modules/ngx_http_static_module.c
===================================================================
--- nginx-catap.orig/nginx/src/http/modules/ngx_http_static_module.c
+++ nginx-catap/nginx/src/http/modules/ngx_http_static_module.c
@@ -139,6 +139,10 @@ ngx_http_static_handler(ngx_http_request
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http dir");
+ if (r->headers_out.location) {
+ r->headers_out.location->hash = 0;
+ }
+
r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t));
if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
Index: nginx-catap/nginx/src/http/ngx_http_core_module.c
===================================================================
--- nginx-catap.orig/nginx/src/http/ngx_http_core_module.c
+++ nginx-catap/nginx/src/http/ngx_http_core_module.c
@@ -1029,6 +1029,10 @@ ngx_http_core_find_config_phase(ngx_http
}
if (rc == NGX_DONE) {
+ if (r->headers_out.location) {
+ r->headers_out.location->hash = 0;
+ }
+
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
@@ -1850,6 +1854,10 @@ ngx_http_send_response(ngx_http_request_
if (status >= NGX_HTTP_MOVED_PERMANENTLY && status <= NGX_HTTP_SEE_OTHER) {
+ if (r->headers_out.location) {
+ r->headers_out.location->hash = 0;
+ }
+
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
Index: nginx-catap/nginx/src/http/ngx_http_script.c
===================================================================
--- nginx-catap.orig/nginx/src/http/ngx_http_script.c
+++ nginx-catap/nginx/src/http/ngx_http_script.c
@@ -1114,6 +1114,10 @@ ngx_http_script_regex_end_code(ngx_http_
"rewritten redirect: \"%V\"", &e->buf);
}
+ if (r->headers_out.location) {
+ r->headers_out.location->hash = 0;
+ }
+
r->headers_out.location = ngx_list_push(&r->headers_out.headers);
if (r->headers_out.location == NULL) {
e->ip = ngx_http_script_exit;
Index: nginx-catap/nginx/src/http/ngx_http_special_response.c
===================================================================
--- nginx-catap.orig/nginx/src/http/ngx_http_special_response.c
+++ nginx-catap/nginx/src/http/ngx_http_special_response.c
@@ -582,6 +582,10 @@ ngx_http_send_error_page(ngx_http_reques
ngx_str_set(&location->key, "Location");
location->value = uri;
+ if (r->headers_out.location) {
+ r->headers_out.location->hash = 0;
+ }
+
r->headers_out.location = location;
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);