mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Merge pull request #2519 from titeuf87/no_ipv6_fallback_fix
Fallback correctly to ipv4 when ipv6 is not supported
This commit is contained in:
commit
96c8c75ce6
@ -855,6 +855,8 @@ class TCPServer:
|
|||||||
if self.address[0] == 'localhost':
|
if self.address[0] == 'localhost':
|
||||||
raise socket.error("Binding to 'localhost' is prohibited. Please use '::1' or '127.0.0.1' directly.")
|
raise socket.error("Binding to 'localhost' is prohibited. Please use '::1' or '127.0.0.1' directly.")
|
||||||
|
|
||||||
|
self.socket = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# First try to bind an IPv6 socket, with possible IPv4 if the OS supports it.
|
# First try to bind an IPv6 socket, with possible IPv4 if the OS supports it.
|
||||||
# This allows us to accept connections for ::1 and 127.0.0.1 on the same socket.
|
# This allows us to accept connections for ::1 and 127.0.0.1 on the same socket.
|
||||||
|
Loading…
Reference in New Issue
Block a user