faster local_hosts lookup
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.1.0 (2012-10-10 11:25:21) dev
|
||||
Version 2.1.0 (2012-10-10 11:43:02) dev
|
||||
|
||||
+13
-12
@@ -426,18 +426,19 @@ def wsgibase(environ, responder):
|
||||
app = request.application ## must go after url_in!
|
||||
|
||||
http_host = env.http_host.split(':',1)[0]
|
||||
local_hosts = [http_host,'::1','127.0.0.1',
|
||||
'::ffff:127.0.0.1']
|
||||
if not global_settings.web2py_runtime_gae:
|
||||
try:
|
||||
local_hosts.append(socket.gethostname())
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
local_hosts.append(
|
||||
socket.gethostbyname(http_host))
|
||||
except (socket.gaierror,TypeError):
|
||||
pass
|
||||
if not global_settings.local_hosts:
|
||||
local_hosts = ['127.0.0.1','::ffff:127.0.0.1']
|
||||
if not global_settings.web2py_runtime_gae:
|
||||
try:
|
||||
local_hosts.append(socket.gethostname())
|
||||
except TypeError:
|
||||
pass
|
||||
try:
|
||||
local_hosts.append(socket.gethostbyname(http_host))
|
||||
except (socket.gaierror,TypeError):
|
||||
pass
|
||||
global_settings.local_hosts = local_hosts
|
||||
local_hosts = global_settings.local_hosts + [http_host]
|
||||
client = get_client(env)
|
||||
x_req_with = str(env.http_x_requested_with).lower()
|
||||
|
||||
|
||||
+1
-1
@@ -6,6 +6,7 @@ License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
import os
|
||||
import sys
|
||||
import socket
|
||||
import platform
|
||||
from storage import Storage
|
||||
|
||||
@@ -37,4 +38,3 @@ global_settings.is_jython = \
|
||||
str(sys.copyright).find('Jython') > 0
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user