better info to debug issue 921
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.00.0 (2012-08-08 09:24:53) dev
|
Version 2.00.0 (2012-08-08 09:34:59) dev
|
||||||
|
|||||||
+2
-1
@@ -405,7 +405,8 @@ def wsgibase(environ, responder):
|
|||||||
except socket.gaierror: pass
|
except socket.gaierror: pass
|
||||||
request.client = get_client(request.env)
|
request.client = get_client(request.env)
|
||||||
if not is_valid_ip_address(request.client):
|
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.folder = abspath('applications',
|
||||||
request.application) + os.sep
|
request.application) + os.sep
|
||||||
x_req_with = str(request.env.http_x_requested_with).lower()
|
x_req_with = str(request.env.http_x_requested_with).lower()
|
||||||
|
|||||||
+4
-4
@@ -157,14 +157,14 @@ def is_valid_ip_address(address):
|
|||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if address.count('.')==3:
|
if address.count('.')==3: # guess IPv4
|
||||||
addr = socket.inet_aton(address)
|
addr = socket.inet_aton(address)
|
||||||
else:
|
else: # guess IPv6
|
||||||
addr = socket.inet_pton(socket.AF_INET6, address)
|
addr = socket.inet_pton(socket.AF_INET6, address)
|
||||||
|
except socket.error: # invalid address
|
||||||
|
return False
|
||||||
except AttributeError: # no socket.inet_pton
|
except AttributeError: # no socket.inet_pton
|
||||||
return False
|
return False
|
||||||
except socket.error:
|
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user