()
| 266 | |
| 267 | def ssl_context(conf): |
| 268 | def default_ssl_context_factory(): |
| 269 | context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH, cafile=conf.ca_certs) |
| 270 | context.load_cert_chain(certfile=conf.certfile, keyfile=conf.keyfile) |
| 271 | context.verify_mode = conf.cert_reqs |
| 272 | if conf.ciphers: |
| 273 | context.set_ciphers(conf.ciphers) |
| 274 | |
| 275 | # Configure ALPN for HTTP/2 if enabled |
| 276 | alpn_protocols = _get_alpn_protocols(conf) |
| 277 | if alpn_protocols: |
| 278 | context.set_alpn_protocols(alpn_protocols) |
| 279 | |
| 280 | return context |
| 281 | |
| 282 | return conf.ssl_context(conf, default_ssl_context_factory) |
| 283 |
no test coverage detected