Commit ae2e1bd
committed
skip
`utils.py` has support for detecting whether the `ssl` module is available, and
we can use this to omit SSL-specific funcionality while still providing other
features (e.g. unencrypted connections).
Prior to this patch, the `connection.py` modules both triggered an `ImportError`
due to unconditional imports of the `ssl` module. Now, we check
`utils.SSL_AVAILABLE` prior to attempting the import and only raise an error
later if (and only if) the application requests an encrypted connection. This
helps support platforms such as `wasm32-wasi` where the `ssl` module is not
built by default.
Signed-off-by: Joel Dice <[email protected]>ssl import if not available1 parent f6a4b49 commit ae2e1bd
2 files changed
+23
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
28 | 37 | | |
29 | 38 | | |
30 | 39 | | |
| |||
740 | 749 | | |
741 | 750 | | |
742 | 751 | | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
743 | 755 | | |
744 | 756 | | |
745 | 757 | | |
| |||
800 | 812 | | |
801 | 813 | | |
802 | 814 | | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
803 | 818 | | |
804 | 819 | | |
805 | 820 | | |
| |||
820 | 835 | | |
821 | 836 | | |
822 | 837 | | |
823 | | - | |
| 838 | + | |
824 | 839 | | |
825 | 840 | | |
826 | 841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
0 commit comments