Στις 5/7/2013 3:06 πμ, ο/η Nobody έγραψε:
On Thu, 04 Jul 2013 13:38:09 +0300, Νίκος wrote:

So you are also suggesting that what gesthostbyaddr() returns is not
utf-8 encoded too?

The gethostbyaddr() OS function returns a byte string with no specified
encoding. Python 3 will doubtless try to decode that to a character string
using some (probably unspecified) encoding.

Names obtained from DNS should consist entirely of ASCII characters
(gethostbyname shouldn't attempt to decode internationalised names
which use IDN, it should return the raw data).

Names obtained by other means (e.g. /etc/hosts or Active Directory) could
contain anything, but if you use non-ASCII hostnames you're asking for
trouble.


Please help because i just happened to noticed that after having this code:

try:
        host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0]
except Exception as e:
        host = "Reverse DNS Failed"


all requests are being resolves, result to:


Reverse DNS Failed as you can see here:
http://superhost.gr/?show=log&page=index.html

How can the above code not be able to reeverse dns any more and it falls back to the failed string?

--
What is now proved was at first only imagined!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to