summarylogtreecommitdiffstats
path: root/pushstream.patch
blob: 82b895c92978a525cae13d66aeeab0020bfd4af6 (plain)
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
--- src/nginx-push-stream-module-0.5.5/src/ngx_http_push_stream_module_utils.c	2022-08-26 13:49:34.000000000 +0000
+++ src/nginx-push-stream-module-0.5.5/src/ngx_http_push_stream_module_utils.c	2022-08-26 13:48:01.000000000 +0000
@@ -2149,8 +2149,12 @@
 {
     size_t            len;
     time_t            now, expires_header_time, max_age;
+#if (nginx_version >= 1023000)
+    ngx_table_elt_t  *expires_header, *cc;
+#else
     ngx_uint_t        i;
     ngx_table_elt_t  *expires_header, *cc, **ccp;
+#endif
 
     expires_header = r->headers_out.expires;
 
@@ -2170,6 +2174,32 @@
     len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT");
     expires_header->value.len = len - 1;
 
+#if (nginx_version >= 1023000)
+    cc = r->headers_out.cache_control;
+
+    if (cc == NULL) {
+
+        cc = ngx_list_push(&r->headers_out.headers);
+        if (cc == NULL) {
+            expires_header->hash = 0;
+            return NGX_ERROR;
+        }
+
+        r->headers_out.cache_control = cc;
+        cc->next = NULL;
+
+        cc->hash = 1;
+        ngx_str_set(&cc->key, "Cache-Control");
+
+    } else {
+        for (cc = cc->next; cc; cc = cc->next) {
+            cc->hash = 0;
+        }
+
+        cc = r->headers_out.cache_control;
+        cc->next = NULL;
+    }
+#else
     ccp = r->headers_out.cache_control.elts;
 
     if (ccp == NULL) {
@@ -2199,6 +2229,8 @@
 
         cc = ccp[0];
     }
+#endif
+
 
     if (expires == NGX_HTTP_PUSH_STREAM_EXPIRES_EPOCH) {
         expires_header->value.data = (u_char *) "Thu, 01 Jan 1970 00:00:01 GMT";