Commit 77def91
authored
tls,http2: send fatal alert on ALPN mismatch
To comply with RFC 7301, make TLS servers send a fatal alert during the
TLS handshake if both the client and the server are configured to use
ALPN and if the server does not support any of the protocols advertised
by the client.
This affects HTTP/2 servers. Until now, applications could intercept the
'unknownProtocol' event when the client either did not advertise any
protocols or if the list of protocols advertised by the client did not
include HTTP/2 (or HTTP/1.1 if allowHTTP1 was true). With this change,
only the first case can be handled, and the 'unknownProtocol' event will
not be emitted in the second case because the TLS handshake fails and no
secure connection is established.
PR-URL: #44031
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>1 parent 938212f commit 77def91Copy full SHA for 77def91
File tree
Expand file treeCollapse file tree
7 files changed
+107
-19
lines changedOpen diff view settings
Filter options
- doc/api
- lib/internal/http2
- src/crypto
- test/parallel
Expand file treeCollapse file tree
7 files changed
+107
-19
lines changedOpen diff view settings
Collapse file
+14Lines changed: 14 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2275 | 2275 | |
2276 | 2276 | |
2277 | 2277 | |
| 2278 | + |
| 2279 | + |
| 2280 | + |
| 2281 | + |
| 2282 | + |
2278 | 2283 | |
2279 | 2284 | |
2280 | 2285 | |
| ||
2284 | 2289 | |
2285 | 2290 | |
2286 | 2291 | |
| 2292 | + |
| 2293 | + |
| 2294 | + |
| 2295 | + |
| 2296 | + |
| 2297 | + |
| 2298 | + |
| 2299 | + |
| 2300 | + |
2287 | 2301 | |
2288 | 2302 | |
2289 | 2303 | |
|
Collapse file
+7-2Lines changed: 7 additions & 2 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
683 | 683 | |
684 | 684 | |
685 | 685 | |
686 | | - |
687 | | - |
| 686 | + |
| 687 | + |
688 | 688 | |
689 | 689 | |
690 | 690 | |
| ||
2012 | 2012 | |
2013 | 2013 | |
2014 | 2014 | |
| 2015 | + |
| 2016 | + |
| 2017 | + |
| 2018 | + |
| 2019 | + |
2015 | 2020 | |
2016 | 2021 | |
2017 | 2022 | |
|
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3055 | 3055 | |
3056 | 3056 | |
3057 | 3057 | |
3058 | | - |
| 3058 | + |
3059 | 3059 | |
3060 | 3060 | |
3061 | 3061 | |
|
Collapse file
+7-7Lines changed: 7 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
246 | 246 | |
247 | 247 | |
248 | 248 | |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
256 | 256 | |
257 | 257 | |
258 | 258 | |
|
Collapse file
test/parallel/test-http2-https-fallback.js
Copy file name to clipboardExpand all lines: test/parallel/test-http2-https-fallback.js+13-3Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | | - |
| 129 | + |
130 | 130 | |
131 | 131 | |
132 | 132 | |
| ||
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | | - |
153 | 152 | |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | + |
| 163 | + |
154 | 164 | |
155 | 165 | |
156 | 166 | |
157 | | - |
| 167 | + |
158 | 168 | |
159 | 169 | |
160 | 170 | |
|
Collapse file
test/parallel/test-http2-server-unknown-protocol.js
Copy file name to clipboardExpand all lines: test/parallel/test-http2-server-unknown-protocol.js+17-3Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
8 | 8 | |
9 | 9 | |
10 | 10 | |
| 11 | + |
11 | 12 | |
12 | 13 | |
13 | 14 | |
| ||
18 | 19 | |
19 | 20 | |
20 | 21 | |
21 | | - |
| 22 | + |
22 | 23 | |
23 | 24 | |
24 | 25 | |
25 | | - |
| 26 | + |
26 | 27 | |
27 | 28 | |
| 29 | + |
| 30 | + |
| 31 | + |
28 | 32 | |
29 | 33 | |
30 | 34 | |
31 | | - |
32 | 35 | |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
33 | 47 | |
Collapse file
test/parallel/test-tls-alpn-server-client.js
Copy file name to clipboardExpand all lines: test/parallel/test-tls-alpn-server-client.js+48-3Lines changed: 48 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
5 | 5 | |
6 | 6 | |
7 | 7 | |
| 8 | + |
8 | 9 | |
9 | 10 | |
10 | 11 | |
| ||
68 | 69 | |
69 | 70 | |
70 | 71 | |
71 | | - |
| 72 | + |
72 | 73 | |
73 | 74 | |
74 | 75 | |
| ||
82 | 83 | |
83 | 84 | |
84 | 85 | |
85 | | - |
86 | | - |
| 86 | + |
| 87 | + |
87 | 88 | |
88 | 89 | |
89 | 90 | |
| ||
161 | 162 | |
162 | 163 | |
163 | 164 | |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
| 208 | + |
164 | 209 | |
165 | 210 | |
166 | 211 | |
0 commit comments