Commit 6dbfa0b
committed
Re-raise
This commit relies on the bugfix proposed in PR python-trio/trio#3413 to
address issue #199.
From the user's perspective, the issue was that a TLS client hanged after
submitting an invalid (e.g. expired) client certificate.
The trio bugfix makes sure that the server (in general, peer) sends out the TLS
alert after catching a `ssl.CertificateError`. In this commit, we do two
things.
First, we intercept `ssl.SSLError`s created by the alerts when receiving data
from the stream (`WebSocketConnection._reader_task`) and sending data to the
stream (`WebSocketConnection._send`), and wrap them into a `HandshakeError`.
Second, we catch and ignore these `HandshakeError`s in
`WebSocketServer._handle_connection`, so that a certificate error does not
crash the server. Here, I'm unsure whether we should ignore *all* SSL
errors (currently, this is the case), or maybe only those generated by alerts,
or only those having to do with certificates, and neither do I know how to
compile a comprehensive list of the latter, if that is what should be done.SSLErrors produced by TLS alerts as HandshakeErrors.1 parent e828e54 commit 6dbfa0b
File tree
3 files changed
+130
-3
lines changed- tests
- trio_websocket
3 files changed
+130
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
3 | 8 | | |
4 | 9 | | |
5 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
279 | 382 | | |
280 | 383 | | |
281 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1570 | 1570 | | |
1571 | 1571 | | |
1572 | 1572 | | |
1573 | | - | |
| 1573 | + | |
1574 | 1574 | | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
1575 | 1578 | | |
1576 | 1579 | | |
1577 | 1580 | | |
| |||
1608 | 1611 | | |
1609 | 1612 | | |
1610 | 1613 | | |
1611 | | - | |
| 1614 | + | |
1612 | 1615 | | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
1613 | 1619 | | |
1614 | 1620 | | |
1615 | 1621 | | |
| |||
1783 | 1789 | | |
1784 | 1790 | | |
1785 | 1791 | | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
1786 | 1805 | | |
1787 | 1806 | | |
1788 | 1807 | | |
1789 | 1808 | | |
1790 | 1809 | | |
1791 | 1810 | | |
1792 | | - | |
| 1811 | + | |
1793 | 1812 | | |
1794 | 1813 | | |
1795 | 1814 | | |
| |||
0 commit comments