2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-27 19:37:57 +00:00

Tolerate certain HTTP clients

Some HTTP clients put the port
number into the host header.
We don't care about port number.
This commit is contained in:
Jarrod Johnson 2020-06-08 11:29:31 -04:00
parent 0a2ab341a8
commit fa9f9c1d99

View File

@ -59,6 +59,10 @@ def handle_request(env, start_response):
reqbody = env['wsgi.input'].read(int(env['CONTENT_LENGTH']))
if env['PATH_INFO'] == '/self/deploycfg':
myip = env.get('HTTP_X_FORWARDED_HOST', None)
if ']' in myip:
myip = myip.split(']', 1)[0]
else:
myip = myip.split(':', 1)[0]
myip = myip.replace('[', '').replace(']', '')
ncfg = netutil.get_nic_config(cfg, nodename, serverip=myip)
if ncfg['prefix']: