diff --git a/VERSION b/VERSION index 36f1d431..f097e61b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-08-08 09:24:53) dev +Version 2.00.0 (2012-08-08 09:34:59) dev diff --git a/gluon/main.py b/gluon/main.py index d1009df9..6549e7f0 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -405,7 +405,8 @@ def wsgibase(environ, responder): except socket.gaierror: pass request.client = get_client(request.env) if not is_valid_ip_address(request.client): - raise HTTP(400,"Bad Request") + raise HTTP(400,"Bad Request (request.client=%s)" % \ + request.client) request.folder = abspath('applications', request.application) + os.sep x_req_with = str(request.env.http_x_requested_with).lower() diff --git a/gluon/utils.py b/gluon/utils.py index 7a55d1fc..5acc5494 100644 --- a/gluon/utils.py +++ b/gluon/utils.py @@ -157,14 +157,14 @@ def is_valid_ip_address(address): True """ try: - if address.count('.')==3: + if address.count('.')==3: # guess IPv4 addr = socket.inet_aton(address) - else: + else: # guess IPv6 addr = socket.inet_pton(socket.AF_INET6, address) + except socket.error: # invalid address + return False except AttributeError: # no socket.inet_pton return False - except socket.error: - return False return True