File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -490,12 +490,17 @@ def _build_request(
490490 if not files :
491491 files = cast (HttpxRequestFiles , ForceMultipartDict ())
492492
493+ prepared_url = self ._prepare_url (options .url )
494+ if "_" in prepared_url .host :
495+ # work around https://github.com/encode/httpx/discussions/2880
496+ kwargs ["extensions" ] = {"sni_hostname" : prepared_url .host .replace ("_" , "-" )}
497+
493498 # TODO: report this error to httpx
494499 return self ._client .build_request ( # pyright: ignore[reportUnknownMemberType]
495500 headers = headers ,
496501 timeout = self .timeout if isinstance (options .timeout , NotGiven ) else options .timeout ,
497502 method = options .method ,
498- url = self . _prepare_url ( options . url ) ,
503+ url = prepared_url ,
499504 # the `Query` type that we use is incompatible with qs'
500505 # `Params` type as it needs to be typed as `Mapping[str, object]`
501506 # so that passing a `TypedDict` doesn't cause an error.
You can’t perform that action at this time.
0 commit comments