Mercurial > hg > nginx
annotate docs/xsls/changes.xsls @ 7680:39501ce97e29
gRPC: generate error when response size is wrong.
As long as the "Content-Length" header is given, we now make sure
it exactly matches the size of the response. If it doesn't,
the response is considered malformed and must not be forwarded
(https://tools.ietf.org/html/rfc7540#section-8.1.2.6). While it
is not really possible to "not forward" the response which is already
being forwarded, we generate an error instead, which is the closest
equivalent.
Previous behaviour was to pass everything to the client, but this
seems to be suboptimal and causes issues (ticket #1695). Also this
directly contradicts HTTP/2 specification requirements.
Note that the new behaviour for the gRPC proxy is more strict than that
applied in other variants of proxying. This is intentional, as HTTP/2
specification requires us to do so, while in other types of proxying
malformed responses from backends are well known and historically
tolerated.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 06 Jul 2020 18:36:25 +0300 |
parents | 529f10f7757c |
children | e79c7521aaf4 |
rev | line source |
---|---|
450 | 1 X:stylesheet { |
2 | |
4028
76bc29f06168
CHANGES conversion from KOI8-R to UTF-8.
Igor Sysoev <igor@sysoev.ru>
parents:
4025
diff
changeset
|
3 X:output method="text"; |
450 | 4 |
5 X:param lang="'en'"; | |
6 X:param configuration="'../xml/change_log_conf.xml'"; | |
7 | |
8 X:var conf = "document($configuration)/configuration"; | |
9 X:var start = "$conf/start"; | |
10 X:var indent = "$conf/indent"; | |
11 X:var max = "$conf/length"; | |
12 X:var br = {<br>} | |
13 | |
14 | |
15 X:template = "/" { !! "change_log"; } | |
16 X:template = "change_log" { !! "changes"; } | |
17 | |
18 | |
19 X:template = "changes" { | |
20 X:text { } | |
21 | |
22 !{substring(concat($conf/changes[@lang=$lang]/title, | |
23 //change_log/@title, | |
24 ' ', @ver, | |
25 ' '), | |
26 1, $conf/changes[@lang=$lang]/length)} | |
27 | |
6914
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
28 X:if "$lang='ru'" { |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
29 !{substring(@date, 9, 2)} |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
30 X:text {.} |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
31 !{substring(@date, 6, 2)} |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
32 X:text {.} |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
33 !{substring(@date, 1, 4)} |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
34 } |
450 | 35 |
36 X:if "$lang='en'" { | |
6914
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
37 !{substring(@date, 9, 2)} |
450 | 38 !{$conf/changes[@lang=$lang]/month[number(substring(current()/@date, |
6914
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
39 6, 2))]} |
529f10f7757c
Docs: changes.xml dates converted to ISO 8601 format.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4028
diff
changeset
|
40 !{substring(@date, 1, 4)} |
450 | 41 } |
42 | |
43 X:text { } | |
44 | |
45 !! "change"; | |
46 | |
47 X:text { } | |
48 } | |
49 | |
50 | |
51 X:template = "change" { | |
52 X:var prefix = "$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]" | |
53 | |
54 X:var postfix = { X:if "$prefix" { X:text {: } } } | |
55 | |
56 !! "para[@lang=$lang]" (prefix = "concat($start, $prefix, $postfix)"); | |
57 } | |
58 | |
59 | |
60 X:template para(prefix) = "para" { | |
61 X:var text = { !!; } | |
62 | |
63 X:text { } | |
64 | |
65 !wrap(text = "normalize-space($text)", | |
66 prefix = { X:if "position() = 1" { !{$prefix} } else { !{$indent} } }) | |
67 } | |
68 | |
69 | |
70 X:template wrap(text, prefix) { | |
71 X:if "$text" { | |
72 X:var offset = { | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
73 X:choose { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
74 X:when "starts-with($text, concat($br, ' '))" { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
75 !{string-length($br) + 2} |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
76 } |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
77 X:when "starts-with($text, $br)" { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
78 !{string-length($br) + 1} |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
79 } |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
80 X:otherwise { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
81 1 |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
82 } |
450 | 83 } |
84 } | |
85 | |
86 X:var length = { | |
87 !length(text = "substring($text, $offset)", | |
88 prefix = "string-length($prefix)", | |
89 length = "$max") | |
90 } | |
91 | |
92 !{$prefix} | |
93 | |
4025
7b85e695600a
Traling spaces removal in text CHANGES files.
Igor Sysoev <igor@sysoev.ru>
parents:
4022
diff
changeset
|
94 !{normalize-space(translate(substring($text, $offset, $length), |
7b85e695600a
Traling spaces removal in text CHANGES files.
Igor Sysoev <igor@sysoev.ru>
parents:
4022
diff
changeset
|
95 ' ', ' '))} |
450 | 96 |
97 X:text { } | |
98 | |
99 !wrap(text = "substring($text, $length + $offset)", prefix = "$indent") | |
100 } | |
101 } | |
102 | |
103 | |
104 X:template length(text, prefix, length) { | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
105 X:var break = "substring-before(substring($text, 1, |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
106 $length - $prefix + string-length($br)), |
450 | 107 $br)" |
108 | |
109 X:choose { | |
110 X:when "$break" { !{string-length($break)} } | |
111 | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
112 X:when "$length = 0" { !{$max - $prefix} } |
450 | 113 |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
114 X:when "string-length($text) + $prefix <= $length" { |
450 | 115 !{$length - $prefix} |
116 } | |
117 | |
4022
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
118 X:when "substring($text, $length - $prefix + 1, 1) = ' '" { |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
119 !{$length - $prefix + 1} |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
120 } |
10b3b7908efb
- support <br/> in the middle of input
Ruslan Ermilov <ru@nginx.com>
parents:
450
diff
changeset
|
121 |
450 | 122 X:otherwise { |
123 !length(text = "$text", prefix = "$prefix", length = "$length - 1") | |
124 } | |
125 } | |
126 } | |
127 | |
128 | |
129 X:template = "at" {@} | |
130 X:template = "br" { !{$br} } | |
131 X:template = "nobr" { !{translate(., ' ', ' ')} } | |
132 | |
133 | |
134 } |