http.client and dns lookups

Barry barry at barrys-emacs.org
Tue Feb 1 12:05:52 EST 2022



> On 31 Jan 2022, at 19:22, Dieter Maurer <dieter at handshake.de> wrote:
> 
> Michael Welle wrote at 2022-1-30 09:18 +0100:
>> ...
> The machine this is running on regularly switches
>> its network configuration without restarting the Python application. Now
>> it turns out that the application is still using an old, outdated dns
>> server after such a network configuration switch.
> 
> It is unlikely that Python performs the host -> IP address translation
> itself. Almost surely, the translation is delegated to functions
> of the underlying C runtime library, e.g. "gethostbyname".

And glibc does not have the ability to reload the /etc/resolv.conf I recall.
If you rely on that you will need to change to using something like dnsmasq or systemd-resolved so that resolv.conf uses localhost.

Barry


> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list