-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeep-alive.patch
More file actions
30 lines (25 loc) · 1.29 KB
/
keep-alive.patch
File metadata and controls
30 lines (25 loc) · 1.29 KB
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
diff -Naur a/src/http/ngx_http_header_filter_module.c b/src/http/ngx_http_header_filter_module.c
--- a/src/http/ngx_http_header_filter_module.c
+++ b/src/http/ngx_http_header_filter_module.c
@@ -383,7 +383,10 @@ ngx_http_header_filter(ngx_http_request_
len += sizeof("Connection: upgrade" CRLF) - 1;
} else if (r->keepalive) {
- len += sizeof("Connection: keep-alive" CRLF) - 1;
+
+ if (r->http_version < NGX_HTTP_VERSION_11 || clcf->keepalive_header) {
+ len += sizeof("Connection: keep-alive" CRLF) - 1;
+ }
/*
* MSIE and Opera ignore the "Keep-Alive: timeout=<N>" header.
@@ -556,8 +559,11 @@ ngx_http_header_filter(ngx_http_request_
sizeof("Connection: upgrade" CRLF) - 1);
} else if (r->keepalive) {
- b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
- sizeof("Connection: keep-alive" CRLF) - 1);
+
+ if (r->http_version < NGX_HTTP_VERSION_11 || clcf->keepalive_header) {
+ b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,
+ sizeof("Connection: keep-alive" CRLF) - 1);
+ }
if (clcf->keepalive_header) {
b->last = ngx_sprintf(b->last, "Keep-Alive: timeout=%T" CRLF,