8000 fix openssl error reasons (#5739) · arihant2math/RustPython@f55bf8f · GitHub
[go: up one dir, main page]

Skip to content

Commit f55bf8f

Browse files
authored
fix openssl error reasons (RustPython#5739)
1 parent ff10a64 commit f55bf8f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Lib/test/test_httplib.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,8 +1695,6 @@ def test_attributes(self):
16951695
h = client.HTTPSConnection(HOST, TimeoutTest.PORT, timeout=30)
16961696
self.assertEqual(h.timeout, 30)
16971697

1698-
# TODO: RUSTPYTHON
1699-
@unittest.expectedFailure
17001698
def test_networked(self):
17011699
# Default settings: requires a valid cert from a trusted CA
17021700
import ssl
@@ -1769,8 +1767,6 @@ def test_networked_good_cert(self):
17691767
h.close()
17701768
self.assertIn('nginx', server_string)
17711769

1772-
# TODO: RUSTPYTHON
1773-
@unittest.expectedFailure
17741770
def test_networked_bad_cert(self):
17751771
# We feed a "CA" cert that is unrelated to the server's cert
17761772
import ssl

stdlib/src/ssl.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,8 +1183,12 @@ mod _ssl {
11831183
let file = file
11841184
.rsplit_once(&['/', '\\'][..])
11851185
.map_or(file, |(_, basename)| basename);
1186-
// TODO: map the error codes to code names, e.g. "CERTIFICATE_VERIFY_FAILED", just requires a big hashmap/dict
1187-
let errstr = e.reason().unwrap_or("unknown error");
1186+
// TODO: finish map
1187+
let default_errstr = e.reason().unwrap_or("unknown error");
1188+
let errstr = match default_errstr {
1189+
"certificate verify failed" => "CERTIFICATE_VERIFY_FAILED",
1190+
_ => default_errstr,
1191+
};
11881192
let msg = if let Some(lib) = e.library() {
11891193
// add `library` attribute
11901194
let attr_name = vm.ctx.as_ref().intern_str("library");

0 commit comments

Comments
 (0)
0