Mercurial > hg > nginx-quic
annotate src/http/ngx_http_variables.h @ 8759:56dec0d4e5b1 quic
QUIC: avoid excessive buffer allocations in stream output.
Previously, when a few bytes were send to a QUIC stream by the application, a
4K buffer was allocated for these bytes. Then a STREAM frame was created and
that entire buffer was used as data for that frame. The frame with the buffer
were in use up until the frame was acked by client. Meanwhile, when more
bytes were send to the stream, more buffers were allocated and assigned as
data to newer STREAM frames. In this scenario most buffer memory is unused.
Now the unused part of the stream output buffer is available for further
stream output while earlier parts of the buffer are waiting to be acked.
This is achieved by splitting the output buffer.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Fri, 24 Dec 2021 18:13:51 +0300 |
parents | 2a288909abc6 |
children | 08b3ea81ff5f |
rev | line source |
---|---|
499 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
499 | 5 */ |
6 | |
7 | |
8 #ifndef _NGX_HTTP_VARIABLES_H_INCLUDED_ | |
9 #define _NGX_HTTP_VARIABLES_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 #include <ngx_http.h> | |
15 | |
16 | |
1310
33d6c994a0b2
Sun Studio on sparc uses different bit order
Igor Sysoev <igor@sysoev.ru>
parents:
1162
diff
changeset
|
17 typedef ngx_variable_value_t ngx_http_variable_value_t; |
499 | 18 |
2008
66dc85397a90
escape 0x00-0x1f, ", and \ in access log variables
Igor Sysoev <igor@sysoev.ru>
parents:
1565
diff
changeset
|
19 #define ngx_http_variable(v) { sizeof(v) - 1, 1, 0, 0, 0, (u_char *) v } |
573 | 20 |
499 | 21 typedef struct ngx_http_variable_s ngx_http_variable_t; |
22 | |
637 | 23 typedef void (*ngx_http_set_variable_pt) (ngx_http_request_t *r, |
24 ngx_http_variable_value_t *v, uintptr_t data); | |
573 | 25 typedef ngx_int_t (*ngx_http_get_variable_pt) (ngx_http_request_t *r, |
26 ngx_http_variable_value_t *v, uintptr_t data); | |
499 | 27 |
28 | |
1565 | 29 #define NGX_HTTP_VAR_CHANGEABLE 1 |
30 #define NGX_HTTP_VAR_NOCACHEABLE 2 | |
31 #define NGX_HTTP_VAR_INDEXED 4 | |
32 #define NGX_HTTP_VAR_NOHASH 8 | |
6899
d2b2ff157da5
Variables: generic prefix variables.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
5127
diff
changeset
|
33 #define NGX_HTTP_VAR_WEAK 16 |
d2b2ff157da5
Variables: generic prefix variables.
Dmitry Volyntsev <xeioex@nginx.com>
parents:
5127
diff
changeset
|
34 #define NGX_HTTP_VAR_PREFIX 32 |
509 | 35 |
36 | |
499 | 37 struct ngx_http_variable_s { |
573 | 38 ngx_str_t name; /* must be first to build the hash */ |
637 | 39 ngx_http_set_variable_pt set_handler; |
40 ngx_http_get_variable_pt get_handler; | |
573 | 41 uintptr_t data; |
42 ngx_uint_t flags; | |
43 ngx_uint_t index; | |
499 | 44 }; |
45 | |
7077
2a288909abc6
Variables: macros for null variables.
Ruslan Ermilov <ru@nginx.com>
parents:
6899
diff
changeset
|
46 #define ngx_http_null_variable { ngx_null_string, NULL, NULL, 0, 0, 0 } |
2a288909abc6
Variables: macros for null variables.
Ruslan Ermilov <ru@nginx.com>
parents:
6899
diff
changeset
|
47 |
499 | 48 |
501 | 49 ngx_http_variable_t *ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, |
509 | 50 ngx_uint_t flags); |
51 ngx_int_t ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name); | |
499 | 52 ngx_http_variable_value_t *ngx_http_get_indexed_variable(ngx_http_request_t *r, |
53 ngx_uint_t index); | |
573 | 54 ngx_http_variable_value_t *ngx_http_get_flushed_variable(ngx_http_request_t *r, |
55 ngx_uint_t index); | |
56 | |
499 | 57 ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r, |
3500
0eb46e3c5c02
change processing variables accessed by SSI and perl module:
Igor Sysoev <igor@sysoev.ru>
parents:
3356
diff
changeset
|
58 ngx_str_t *name, ngx_uint_t key); |
509 | 59 |
1162 | 60 ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v, |
61 ngx_str_t *var, ngx_list_part_t *part, size_t prefix); | |
62 | |
63 | |
3356
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
64 #if (NGX_PCRE) |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
65 |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
66 typedef struct { |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
67 ngx_uint_t capture; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
68 ngx_int_t index; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
69 } ngx_http_regex_variable_t; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
70 |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
71 |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
72 typedef struct { |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
73 ngx_regex_t *regex; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
74 ngx_uint_t ncaptures; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
75 ngx_http_regex_variable_t *variables; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
76 ngx_uint_t nvariables; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
77 ngx_str_t name; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
78 } ngx_http_regex_t; |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
79 |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
80 |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
81 typedef struct { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
82 ngx_http_regex_t *regex; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
83 void *value; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
84 } ngx_http_map_regex_t; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
85 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
86 |
3325 | 87 ngx_http_regex_t *ngx_http_regex_compile(ngx_conf_t *cf, |
88 ngx_regex_compile_t *rc); | |
89 ngx_int_t ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re, | |
90 ngx_str_t *s); | |
91 | |
3356
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
92 #endif |
fe08c14530e9
fix building without PCRE, the bug had been introduced in r3326
Igor Sysoev <igor@sysoev.ru>
parents:
3325
diff
changeset
|
93 |
3325 | 94 |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
95 typedef struct { |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
96 ngx_hash_combined_t hash; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
97 #if (NGX_PCRE) |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
98 ngx_http_map_regex_t *regex; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
99 ngx_uint_t nregex; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
100 #endif |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
101 } ngx_http_map_t; |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
102 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
103 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
104 void *ngx_http_map_find(ngx_http_request_t *r, ngx_http_map_t *map, |
3929
fa4612bfb9fa
change ngx_http_map_find(): use case sensitive regexes
Igor Sysoev <igor@sysoev.ru>
parents:
3872
diff
changeset
|
105 ngx_str_t *match); |
3872
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
106 |
83cd1910329c
allow regex as "map" parameter
Igor Sysoev <igor@sysoev.ru>
parents:
3641
diff
changeset
|
107 |
509 | 108 ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf); |
109 ngx_int_t ngx_http_variables_init_vars(ngx_conf_t *cf); | |
499 | 110 |
111 | |
577 | 112 extern ngx_http_variable_value_t ngx_http_variable_null_value; |
113 extern ngx_http_variable_value_t ngx_http_variable_true_value; | |
114 | |
115 | |
499 | 116 #endif /* _NGX_HTTP_VARIABLES_H_INCLUDED_ */ |