Skip to content
Myr

Address review comments

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by Tom Christie · parent b343ee4 · Browse files · 1 file+8 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−5 removed

  • other:+8 added−5 removed

1 file+8 added−5 removed

modified:httpx/config.py+8 added-5 removed
14 unmodified lines
151617USER_AGENT = f"python-httpx/{__version__}"1819HTTP_VERSIONS_TO_ALPN_IDENTIFIERS = {"HTTP/1.1": "http/1.1", "HTTP/2": "h2"}2021DEFAULT_CIPHERS = ":".join(22 [23 "ECDHE+AESGCM",24 "ECDHE+CHACHA20",
136 unmodified lines
161 context.options |= ssl.OP_NO_COMPRESSION162 context.set_ciphers(DEFAULT_CIPHERS)163164 if ssl.HAS_ALPN:163 context.set_alpn_protocols(http_versions.alpn_strings)165 context.set_alpn_protocols(http_versions.alpn_identifiers)166 if ssl.HAS_NPN: # pragma: no cover165 context.set_npn_protocols(http_versions.alpn_strings)167 context.set_npn_protocols(http_versions.alpn_identifiers)168169 return context170171 def _load_client_certs(self, ssl_context: ssl.SSLContext) -> None:
89 unmodified lines
261 if not self.http_versions:262 raise ValueError(f"HTTP versions cannot be an empty list.")263264 @property263 def alpn_strings(self) -> typing.List[str]:265 def alpn_identifiers(self) -> typing.List[str]:266 """267 Returns a list of supported ALPN identifiers. (One or more of "http/1.1", "h2").268 """267 mapping = {"HTTP/1.1": "http/1.1", "HTTP/2": "h2"}268 return [mapping[version] for version in self.http_versions]269 return [270 HTTP_VERSIONS_TO_ALPN_IDENTIFIERS[version] for version in self.http_versions271 ]272273 def __repr__(self) -> str:274 class_name = self.__class__.__name__275 value = sorted(list(self.http_versions))
40 unmodified lines