UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 0: invalid start byte

Νίκος Gr33k nikos at superhost.gr
Fri Jul 5 16:27:31 CEST 2013

Στις 5/7/2013 5:11 μμ, ο/η Lele Gaifax έγραψε:
> Dave Angel <davea at davea.name> writes:
>> You're quoting from my error output, and that's caused because I don't
>> have such an environment variable.  But you do.
> Dave, maybe you already know, but that variable is "injected" by the CGI
> mechanism, is not coming from the OP shell environment.
> As Νίκος discovered, when he "cloudfare" (whatever that means) his site,
> the REMOTE_HOST envvar contains some (I guess) latin-greek encoded
> string, and the remote address is carried by a different envvar...

Exactly only when i CloudFlare(www.cloudflare.com) the domain the 
hostname cannot be retrieved.

At least i managed to solve this by:

   host = socket.gethostbyaddr( os.environ['HTTP_CF_CONNECTING_IP'] )[0]
except Exception as e:
   host = repr(e)

Seems like when you cloudflare a domain you can  no longer have the
originates ip address of the visitor but you have to read the above
environmental variable to be bale to retrieve it!

What is now proved was at first only imagined!

More information about the Python-list mailing list