annotate src/http/v2/ngx_http_v2_module.c @ 9119:08ef02ad5c54

HTTP/2: "http2" directive. The directive enables HTTP/2 in the current server. The previous way to enable HTTP/2 via "listen ... http2" is now deprecated. The new approach allows to share HTTP/2 and HTTP/0.9-1.1 on the same port. For SSL connections, HTTP/2 is now selected by ALPN callback based on whether the protocol is enabled in the virtual server chosen by SNI. This however only works since OpenSSL 1.0.2h, where ALPN callback is invoked after SNI callback. For older versions of OpenSSL, HTTP/2 is enabled based on the default virtual server configuration. For plain TCP connections, HTTP/2 is now auto-detected by HTTP/2 preface, if HTTP/2 is enabled in the default virtual server. If preface is not matched, HTTP/0.9-1.1 is assumed.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 16 May 2023 16:30:08 +0400
parents 827202ca1269
children 262c01782566
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
1
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
2 /*
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
3 * Copyright (C) Nginx, Inc.
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
4 * Copyright (C) Valentin V. Bartenev
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
5 */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
6
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
7
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
8 #include <ngx_config.h>
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
9 #include <ngx_core.h>
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
10 #include <ngx_http.h>
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
11 #include <ngx_http_v2_module.h>
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
12
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
13
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
14 static ngx_int_t ngx_http_v2_add_variables(ngx_conf_t *cf);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
15
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
16 static ngx_int_t ngx_http_v2_variable(ngx_http_request_t *r,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
17 ngx_http_variable_value_t *v, uintptr_t data);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
18
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
19 static ngx_int_t ngx_http_v2_module_init(ngx_cycle_t *cycle);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
20
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
21 static void *ngx_http_v2_create_main_conf(ngx_conf_t *cf);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
22 static char *ngx_http_v2_init_main_conf(ngx_conf_t *cf, void *conf);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
23 static void *ngx_http_v2_create_srv_conf(ngx_conf_t *cf);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
24 static char *ngx_http_v2_merge_srv_conf(ngx_conf_t *cf, void *parent,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
25 void *child);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
26 static void *ngx_http_v2_create_loc_conf(ngx_conf_t *cf);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
27 static char *ngx_http_v2_merge_loc_conf(ngx_conf_t *cf, void *parent,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
28 void *child);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
29
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
30 static char *ngx_http_v2_push(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
31
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
32 static char *ngx_http_v2_recv_buffer_size(ngx_conf_t *cf, void *post,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
33 void *data);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
34 static char *ngx_http_v2_pool_size(ngx_conf_t *cf, void *post, void *data);
6566
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
35 static char *ngx_http_v2_preread_size(ngx_conf_t *cf, void *post, void *data);
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
36 static char *ngx_http_v2_streams_index_mask(ngx_conf_t *cf, void *post,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
37 void *data);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
38 static char *ngx_http_v2_chunk_size(ngx_conf_t *cf, void *post, void *data);
7771
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
39 static char *ngx_http_v2_obsolete(ngx_conf_t *cf, ngx_command_t *cmd,
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
40 void *conf);
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
41
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
42
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
43 static ngx_conf_deprecated_t ngx_http_v2_recv_timeout_deprecated = {
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
44 ngx_conf_deprecated, "http2_recv_timeout", "client_header_timeout"
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
45 };
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
46
7772
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
47 static ngx_conf_deprecated_t ngx_http_v2_idle_timeout_deprecated = {
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
48 ngx_conf_deprecated, "http2_idle_timeout", "keepalive_timeout"
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
49 };
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
50
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
51 static ngx_conf_deprecated_t ngx_http_v2_max_requests_deprecated = {
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
52 ngx_conf_deprecated, "http2_max_requests", "keepalive_requests"
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
53 };
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
54
7774
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
55 static ngx_conf_deprecated_t ngx_http_v2_max_field_size_deprecated = {
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
56 ngx_conf_deprecated, "http2_max_field_size", "large_client_header_buffers"
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
57 };
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
58
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
59 static ngx_conf_deprecated_t ngx_http_v2_max_header_size_deprecated = {
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
60 ngx_conf_deprecated, "http2_max_header_size", "large_client_header_buffers"
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
61 };
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
62
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
63
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
64 static ngx_conf_post_t ngx_http_v2_recv_buffer_size_post =
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
65 { ngx_http_v2_recv_buffer_size };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
66 static ngx_conf_post_t ngx_http_v2_pool_size_post =
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
67 { ngx_http_v2_pool_size };
6566
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
68 static ngx_conf_post_t ngx_http_v2_preread_size_post =
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
69 { ngx_http_v2_preread_size };
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
70 static ngx_conf_post_t ngx_http_v2_streams_index_mask_post =
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
71 { ngx_http_v2_streams_index_mask };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
72 static ngx_conf_post_t ngx_http_v2_chunk_size_post =
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
73 { ngx_http_v2_chunk_size };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
74
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
75
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
76 static ngx_command_t ngx_http_v2_commands[] = {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
77
9119
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
78 { ngx_string("http2"),
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
79 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
80 ngx_conf_set_flag_slot,
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
81 NGX_HTTP_SRV_CONF_OFFSET,
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
82 offsetof(ngx_http_v2_srv_conf_t, enable),
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
83 NULL },
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
84
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
85 { ngx_string("http2_recv_buffer_size"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
86 NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
87 ngx_conf_set_size_slot,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
88 NGX_HTTP_MAIN_CONF_OFFSET,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
89 offsetof(ngx_http_v2_main_conf_t, recv_buffer_size),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
90 &ngx_http_v2_recv_buffer_size_post },
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
91
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
92 { ngx_string("http2_pool_size"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
93 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
94 ngx_conf_set_size_slot,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
95 NGX_HTTP_SRV_CONF_OFFSET,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
96 offsetof(ngx_http_v2_srv_conf_t, pool_size),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
97 &ngx_http_v2_pool_size_post },
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
98
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
99 { ngx_string("http2_max_concurrent_streams"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
100 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
101 ngx_conf_set_num_slot,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
102 NGX_HTTP_SRV_CONF_OFFSET,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
103 offsetof(ngx_http_v2_srv_conf_t, concurrent_streams),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
104 NULL },
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
105
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
106 { ngx_string("http2_max_concurrent_pushes"),
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
107 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
108 ngx_conf_set_num_slot,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
109 NGX_HTTP_SRV_CONF_OFFSET,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
110 offsetof(ngx_http_v2_srv_conf_t, concurrent_pushes),
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
111 NULL },
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
112
6783
9027991e2f37 HTTP/2: limited maximum number of requests in connection.
Valentin Bartenev <vbart@nginx.com>
parents: 6566
diff changeset
113 { ngx_string("http2_max_requests"),
9027991e2f37 HTTP/2: limited maximum number of requests in connection.
Valentin Bartenev <vbart@nginx.com>
parents: 6566
diff changeset
114 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
7772
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
115 ngx_http_v2_obsolete,
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
116 0,
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
117 0,
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
118 &ngx_http_v2_max_requests_deprecated },
6783
9027991e2f37 HTTP/2: limited maximum number of requests in connection.
Valentin Bartenev <vbart@nginx.com>
parents: 6566
diff changeset
119
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
120 { ngx_string("http2_max_field_size"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
121 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
7774
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
122 ngx_http_v2_obsolete,
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
123 0,
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
124 0,
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
125 &ngx_http_v2_max_field_size_deprecated },
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
126
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
127 { ngx_string("http2_max_header_size"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
128 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
7774
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
129 ngx_http_v2_obsolete,
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
130 0,
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
131 0,
827202ca1269 HTTP/2: removed http2_max_field_size and http2_max_header_size.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7772
diff changeset
132 &ngx_http_v2_max_header_size_deprecated },
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
133
6566
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
134 { ngx_string("http2_body_preread_size"),
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
135 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
136 ngx_conf_set_size_slot,
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
137 NGX_HTTP_SRV_CONF_OFFSET,
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
138 offsetof(ngx_http_v2_srv_conf_t, preread_size),
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
139 &ngx_http_v2_preread_size_post },
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
140
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
141 { ngx_string("http2_streams_index_size"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
142 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
143 ngx_conf_set_num_slot,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
144 NGX_HTTP_SRV_CONF_OFFSET,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
145 offsetof(ngx_http_v2_srv_conf_t, streams_index_mask),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
146 &ngx_http_v2_streams_index_mask_post },
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
147
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
148 { ngx_string("http2_recv_timeout"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
149 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
7771
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
150 ngx_http_v2_obsolete,
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
151 0,
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
152 0,
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
153 &ngx_http_v2_recv_timeout_deprecated },
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
154
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
155 { ngx_string("http2_idle_timeout"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
156 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
7772
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
157 ngx_http_v2_obsolete,
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
158 0,
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
159 0,
f790816a0e87 HTTP/2: removed http2_idle_timeout and http2_max_requests.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7771
diff changeset
160 &ngx_http_v2_idle_timeout_deprecated },
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
161
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
162 { ngx_string("http2_chunk_size"),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
163 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
164 ngx_conf_set_size_slot,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
165 NGX_HTTP_LOC_CONF_OFFSET,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
166 offsetof(ngx_http_v2_loc_conf_t, chunk_size),
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
167 &ngx_http_v2_chunk_size_post },
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
168
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
169 { ngx_string("http2_push_preload"),
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
170 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
171 ngx_conf_set_flag_slot,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
172 NGX_HTTP_LOC_CONF_OFFSET,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
173 offsetof(ngx_http_v2_loc_conf_t, push_preload),
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
174 NULL },
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
175
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
176 { ngx_string("http2_push"),
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
177 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
178 ngx_http_v2_push,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
179 NGX_HTTP_LOC_CONF_OFFSET,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
180 0,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
181 NULL },
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
182
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
183 ngx_null_command
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
184 };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
185
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
186
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
187 static ngx_http_module_t ngx_http_v2_module_ctx = {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
188 ngx_http_v2_add_variables, /* preconfiguration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
189 NULL, /* postconfiguration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
190
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
191 ngx_http_v2_create_main_conf, /* create main configuration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
192 ngx_http_v2_init_main_conf, /* init main configuration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
193
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
194 ngx_http_v2_create_srv_conf, /* create server configuration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
195 ngx_http_v2_merge_srv_conf, /* merge server configuration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
196
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
197 ngx_http_v2_create_loc_conf, /* create location configuration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
198 ngx_http_v2_merge_loc_conf /* merge location configuration */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
199 };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
200
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
201
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
202 ngx_module_t ngx_http_v2_module = {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
203 NGX_MODULE_V1,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
204 &ngx_http_v2_module_ctx, /* module context */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
205 ngx_http_v2_commands, /* module directives */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
206 NGX_HTTP_MODULE, /* module type */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
207 NULL, /* init master */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
208 ngx_http_v2_module_init, /* init module */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
209 NULL, /* init process */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
210 NULL, /* init thread */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
211 NULL, /* exit thread */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
212 NULL, /* exit process */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
213 NULL, /* exit master */
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
214 NGX_MODULE_V1_PADDING
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
215 };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
216
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
217
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
218 static ngx_http_variable_t ngx_http_v2_vars[] = {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
219
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
220 { ngx_string("http2"), NULL,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
221 ngx_http_v2_variable, 0, 0, 0 },
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
222
7077
2a288909abc6 Variables: macros for null variables.
Ruslan Ermilov <ru@nginx.com>
parents: 6783
diff changeset
223 ngx_http_null_variable
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
224 };
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
225
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
226
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
227 static ngx_int_t
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
228 ngx_http_v2_add_variables(ngx_conf_t *cf)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
229 {
6474
Ruslan Ermilov <ru@nginx.com>
parents: 6246
diff changeset
230 ngx_http_variable_t *var, *v;
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
231
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
232 for (v = ngx_http_v2_vars; v->name.len; v++) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
233 var = ngx_http_add_variable(cf, &v->name, v->flags);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
234 if (var == NULL) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
235 return NGX_ERROR;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
236 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
237
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
238 var->get_handler = v->get_handler;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
239 var->data = v->data;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
240 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
241
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
242 return NGX_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
243 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
244
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
245
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
246 static ngx_int_t
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
247 ngx_http_v2_variable(ngx_http_request_t *r,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
248 ngx_http_variable_value_t *v, uintptr_t data)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
249 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
250
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
251 if (r->stream) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
252 #if (NGX_HTTP_SSL)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
253
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
254 if (r->connection->ssl) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
255 v->len = sizeof("h2") - 1;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
256 v->valid = 1;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
257 v->no_cacheable = 0;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
258 v->not_found = 0;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
259 v->data = (u_char *) "h2";
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
260
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
261 return NGX_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
262 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
263
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
264 #endif
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
265 v->len = sizeof("h2c") - 1;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
266 v->valid = 1;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
267 v->no_cacheable = 0;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
268 v->not_found = 0;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
269 v->data = (u_char *) "h2c";
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
270
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
271 return NGX_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
272 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
273
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
274 *v = ngx_http_variable_null_value;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
275
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
276 return NGX_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
277 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
278
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
279
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
280 static ngx_int_t
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
281 ngx_http_v2_module_init(ngx_cycle_t *cycle)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
282 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
283 return NGX_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
284 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
285
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
286
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
287 static void *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
288 ngx_http_v2_create_main_conf(ngx_conf_t *cf)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
289 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
290 ngx_http_v2_main_conf_t *h2mcf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
291
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
292 h2mcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v2_main_conf_t));
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
293 if (h2mcf == NULL) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
294 return NULL;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
295 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
296
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
297 h2mcf->recv_buffer_size = NGX_CONF_UNSET_SIZE;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
298
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
299 return h2mcf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
300 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
301
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
302
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
303 static char *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
304 ngx_http_v2_init_main_conf(ngx_conf_t *cf, void *conf)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
305 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
306 ngx_http_v2_main_conf_t *h2mcf = conf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
307
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
308 ngx_conf_init_size_value(h2mcf->recv_buffer_size, 256 * 1024);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
309
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
310 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
311 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
312
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
313
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
314 static void *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
315 ngx_http_v2_create_srv_conf(ngx_conf_t *cf)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
316 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
317 ngx_http_v2_srv_conf_t *h2scf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
318
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
319 h2scf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v2_srv_conf_t));
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
320 if (h2scf == NULL) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
321 return NULL;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
322 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
323
9119
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
324 h2scf->enable = NGX_CONF_UNSET;
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
325
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
326 h2scf->pool_size = NGX_CONF_UNSET_SIZE;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
327
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
328 h2scf->concurrent_streams = NGX_CONF_UNSET_UINT;
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
329 h2scf->concurrent_pushes = NGX_CONF_UNSET_UINT;
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
330
6566
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
331 h2scf->preread_size = NGX_CONF_UNSET_SIZE;
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
332
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
333 h2scf->streams_index_mask = NGX_CONF_UNSET_UINT;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
334
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
335 return h2scf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
336 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
337
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
338
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
339 static char *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
340 ngx_http_v2_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
341 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
342 ngx_http_v2_srv_conf_t *prev = parent;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
343 ngx_http_v2_srv_conf_t *conf = child;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
344
9119
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
345 ngx_conf_merge_value(conf->enable, prev->enable, 0);
08ef02ad5c54 HTTP/2: "http2" directive.
Roman Arutyunyan <arut@nginx.com>
parents: 7774
diff changeset
346
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
347 ngx_conf_merge_size_value(conf->pool_size, prev->pool_size, 4096);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
348
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
349 ngx_conf_merge_uint_value(conf->concurrent_streams,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
350 prev->concurrent_streams, 128);
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
351 ngx_conf_merge_uint_value(conf->concurrent_pushes,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
352 prev->concurrent_pushes, 10);
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
353
6566
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
354 ngx_conf_merge_size_value(conf->preread_size, prev->preread_size, 65536);
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
355
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
356 ngx_conf_merge_uint_value(conf->streams_index_mask,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
357 prev->streams_index_mask, 32 - 1);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
358
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
359 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
360 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
361
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
362
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
363 static void *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
364 ngx_http_v2_create_loc_conf(ngx_conf_t *cf)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
365 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
366 ngx_http_v2_loc_conf_t *h2lcf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
367
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
368 h2lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v2_loc_conf_t));
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
369 if (h2lcf == NULL) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
370 return NULL;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
371 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
372
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
373 /*
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
374 * set by ngx_pcalloc():
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
375 *
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
376 * h2lcf->pushes = NULL;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
377 */
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
378
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
379 h2lcf->chunk_size = NGX_CONF_UNSET_SIZE;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
380
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
381 h2lcf->push_preload = NGX_CONF_UNSET;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
382 h2lcf->push = NGX_CONF_UNSET;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
383
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
384 return h2lcf;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
385 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
386
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
387
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
388 static char *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
389 ngx_http_v2_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
390 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
391 ngx_http_v2_loc_conf_t *prev = parent;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
392 ngx_http_v2_loc_conf_t *conf = child;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
393
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
394 ngx_conf_merge_size_value(conf->chunk_size, prev->chunk_size, 8 * 1024);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
395
7201
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
396 ngx_conf_merge_value(conf->push, prev->push, 1);
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
397
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
398 if (conf->push && conf->pushes == NULL) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
399 conf->pushes = prev->pushes;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
400 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
401
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
402 ngx_conf_merge_value(conf->push_preload, prev->push_preload, 0);
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
403
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
404 return NGX_CONF_OK;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
405 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
406
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
407
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
408 static char *
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
409 ngx_http_v2_push(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
410 {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
411 ngx_http_v2_loc_conf_t *h2lcf = conf;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
412
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
413 ngx_str_t *value;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
414 ngx_http_complex_value_t *cv;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
415 ngx_http_compile_complex_value_t ccv;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
416
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
417 value = cf->args->elts;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
418
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
419 if (ngx_strcmp(value[1].data, "off") == 0) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
420
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
421 if (h2lcf->pushes) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
422 return "\"off\" parameter cannot be used with URI";
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
423 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
424
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
425 if (h2lcf->push == 0) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
426 return "is duplicate";
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
427 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
428
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
429 h2lcf->push = 0;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
430 return NGX_CONF_OK;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
431 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
432
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
433 if (h2lcf->push == 0) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
434 return "URI cannot be used with \"off\" parameter";
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
435 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
436
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
437 h2lcf->push = 1;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
438
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
439 if (h2lcf->pushes == NULL) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
440 h2lcf->pushes = ngx_array_create(cf->pool, 1,
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
441 sizeof(ngx_http_complex_value_t));
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
442 if (h2lcf->pushes == NULL) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
443 return NGX_CONF_ERROR;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
444 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
445 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
446
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
447 cv = ngx_array_push(h2lcf->pushes);
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
448 if (cv == NULL) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
449 return NGX_CONF_ERROR;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
450 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
451
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
452 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
453
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
454 ccv.cf = cf;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
455 ccv.value = &value[1];
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
456 ccv.complex_value = cv;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
457
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
458 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
459 return NGX_CONF_ERROR;
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
460 }
641306096f5b HTTP/2: server push.
Ruslan Ermilov <ru@nginx.com>
parents: 7077
diff changeset
461
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
462 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
463 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
464
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
465
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
466 static char *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
467 ngx_http_v2_recv_buffer_size(ngx_conf_t *cf, void *post, void *data)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
468 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
469 size_t *sp = data;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
470
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
471 if (*sp <= 2 * NGX_HTTP_V2_STATE_BUFFER_SIZE) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
472 return "value is too small";
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
473 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
474
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
475 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
476 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
477
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
478
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
479 static char *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
480 ngx_http_v2_pool_size(ngx_conf_t *cf, void *post, void *data)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
481 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
482 size_t *sp = data;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
483
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
484 if (*sp < NGX_MIN_POOL_SIZE) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
485 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
486 "the pool size must be no less than %uz",
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
487 NGX_MIN_POOL_SIZE);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
488
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
489 return NGX_CONF_ERROR;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
490 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
491
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
492 if (*sp % NGX_POOL_ALIGNMENT) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
493 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
494 "the pool size must be a multiple of %uz",
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
495 NGX_POOL_ALIGNMENT);
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
496
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
497 return NGX_CONF_ERROR;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
498 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
499
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
500 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
501 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
502
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
503
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
504 static char *
6566
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
505 ngx_http_v2_preread_size(ngx_conf_t *cf, void *post, void *data)
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
506 {
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
507 size_t *sp = data;
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
508
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
509 if (*sp > NGX_HTTP_V2_MAX_WINDOW) {
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
510 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
511 "the maximum body preread buffer size is %uz",
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
512 NGX_HTTP_V2_MAX_WINDOW);
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
513
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
514 return NGX_CONF_ERROR;
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
515 }
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
516
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
517 return NGX_CONF_OK;
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
518 }
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
519
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
520
ce94f07d5082 HTTP/2: implemented preread buffer for request body (closes #959).
Valentin Bartenev <vbart@nginx.com>
parents: 6474
diff changeset
521 static char *
6246
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
522 ngx_http_v2_streams_index_mask(ngx_conf_t *cf, void *post, void *data)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
523 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
524 ngx_uint_t *np = data;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
525
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
526 ngx_uint_t mask;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
527
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
528 mask = *np - 1;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
529
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
530 if (*np == 0 || (*np & mask)) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
531 return "must be a power of two";
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
532 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
533
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
534 *np = mask;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
535
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
536 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
537 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
538
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
539
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
540 static char *
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
541 ngx_http_v2_chunk_size(ngx_conf_t *cf, void *post, void *data)
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
542 {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
543 size_t *sp = data;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
544
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
545 if (*sp == 0) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
546 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
547 "the http2 chunk size cannot be zero");
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
548
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
549 return NGX_CONF_ERROR;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
550 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
551
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
552 if (*sp > NGX_HTTP_V2_MAX_FRAME_SIZE) {
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
553 *sp = NGX_HTTP_V2_MAX_FRAME_SIZE;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
554 }
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
555
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
556 return NGX_CONF_OK;
257b51c37c5a The HTTP/2 implementation (RFC 7240, 7241).
Valentin Bartenev <vbart@nginx.com>
parents:
diff changeset
557 }
7771
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
558
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
559
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
560 static char *
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
561 ngx_http_v2_obsolete(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
562 {
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
563 ngx_conf_deprecated_t *d = cmd->post;
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
564
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
565 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
566 "the \"%s\" directive is obsolete, "
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
567 "use the \"%s\" directive instead",
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
568 d->old_name, d->new_name);
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
569
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
570 return NGX_CONF_OK;
02be1baed382 HTTP/2: removed http2_recv_timeout.
Maxim Dounin <mdounin@mdounin.ru>
parents: 7770
diff changeset
571 }