Skip to content

Commit

Permalink
Check system when connecting to UNIX socket (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloliverx committed Nov 21, 2022
1 parent faa166c commit a2f86ca
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions httpcore/backends/sync.py
@@ -1,5 +1,6 @@
import socket
import ssl
import sys
import typing

from .._exceptions import (
Expand Down Expand Up @@ -98,6 +99,11 @@ def connect_tcp(
def connect_unix_socket(
self, path: str, timeout: typing.Optional[float] = None
) -> NetworkStream: # pragma: nocover
if sys.platform == "win32":
raise RuntimeError(
"Attempted to connect to a UNIX socket on a Windows system."
)

exc_map: ExceptionMapping = {
socket.timeout: ConnectTimeout,
OSError: ConnectError,
Expand Down

0 comments on commit a2f86ca

Please sign in to comment.