vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

IPv6 localhost doesn't seem to be included with the defintion of localhost.

Open dragonpaw opened this issue 3 years ago • 2 comments

When I'm trying to allow Redis localhost connections, I have to manually add "::1" to the list of allowed hosts, despite ignore_localhost

dragonpaw avatar Apr 15 '22 02:04 dragonpaw

Ok I've really, really tried to fix this but I hit a wall in the process: Python HTTPServer doesn't support IPv6.

The tests at test_ignore.py uses a httpbin server created with pytest-httpbin which in turn creates a web server using HTTPServer, unfortunately HTTPServer creates the socket internally and we cannot easily manipulate it.

A feasible solution would be to create another fixture in pytest-httpbin (e.g. httpbin_ipv6) which listens on "::1" instead of "127.0.0.1" but HTTPServer have the protocol hardcoded (see here), maybe we can just change that property and it works.

Given that the workaround is as easy as adding "::1" to ignore_hosts I'm not sure it's worth the effort.

I'll left here the branch with the fix implemented, in case someone wants to continue where I left it.

Terseus avatar Nov 01 '22 12:11 Terseus

Thank you for looking into this. You may be right that just adding ::1 is the simplest workaround. (And probably add a note to the documentation to this effect, as it might not be obvious to others who hit this issue.)

dragonpaw avatar Jan 17 '23 22:01 dragonpaw