summaryrefslogtreecommitdiff
path: root/user/nginx/http2-buffer-management.patch
blob: e77b91feb24344ccdc5586684d2b91fc221556f6 (plain) (blame)
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
Source: https://trac.nginx.org/nginx/changeset/ea1f29c2010cda4940b741976f103d547308815a/nginx

This patch was modified from upstream in the following way(s):

* Update path so that the patch applies correctly
* dos2unix

Index: src/http/v2/ngx_http_v2.c
===================================================================
--- a/src/http/v2/ngx_http_v2.c	(revision 9165)
+++ b/src/http/v2/ngx_http_v2.c	(revision 9179)
@@ -387,11 +387,9 @@
                                           ngx_http_v2_module);
 
-    available = h2mcf->recv_buffer_size - 2 * NGX_HTTP_V2_STATE_BUFFER_SIZE;
+    available = h2mcf->recv_buffer_size - NGX_HTTP_V2_STATE_BUFFER_SIZE;
 
     do {
         p = h2mcf->recv_buffer;
-
-        ngx_memcpy(p, h2c->state.buffer, NGX_HTTP_V2_STATE_BUFFER_SIZE);
-        end = p + h2c->state.buffer_used;
+        end = ngx_cpymem(p, h2c->state.buffer, h2c->state.buffer_used);
 
         n = c->recv(c, end, available);
@@ -2593,5 +2591,5 @@
     }
 
-    ngx_memcpy(h2c->state.buffer, pos, NGX_HTTP_V2_STATE_BUFFER_SIZE);
+    ngx_memcpy(h2c->state.buffer, pos, size);
 
     h2c->state.buffer_used = size;
Index: src/http/v2/ngx_http_v2_module.c
===================================================================
--- a/src/http/v2/ngx_http_v2_module.c	(revision 9121)
+++ b/src/http/v2/ngx_http_v2_module.c	(revision 9179)
@@ -389,5 +389,5 @@
     size_t *sp = data;
 
-    if (*sp <= 2 * NGX_HTTP_V2_STATE_BUFFER_SIZE) {
+    if (*sp <= NGX_HTTP_V2_STATE_BUFFER_SIZE) {
         return "value is too small";
     }