Skip to content

Commit e02c8b7

Browse files
committed
Merge pull request #708 from KeepSafe/drop_parse_remote_addr
Drop unused function parse_remote_addr()
2 parents 0ce2475 + a017e8d commit e02c8b7

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

aiohttp/helpers.py

-28
Original file line numberDiff line numberDiff line change
@@ -208,34 +208,6 @@ def guess_filename(obj, default=None):
208208
return default
209209

210210

211-
def parse_remote_addr(forward):
212-
if isinstance(forward, str):
213-
# we only took the last one
214-
# http://en.wikipedia.org/wiki/X-Forwarded-For
215-
if ',' in forward:
216-
forward = forward.rsplit(',', 1)[-1].strip()
217-
218-
# find host and port on ipv6 address
219-
if '[' in forward and ']' in forward:
220-
host = forward.split(']')[0][1:].lower()
221-
elif ':' in forward and forward.count(':') == 1:
222-
host = forward.split(':')[0].lower()
223-
else:
224-
host = forward
225-
226-
forward = forward.split(']')[-1]
227-
if ':' in forward and forward.count(':') == 1:
228-
port = forward.split(':', 1)[1]
229-
else:
230-
port = 80
231-
232-
remote = (host, port)
233-
else:
234-
remote = forward
235-
236-
return remote[0], str(remote[1])
237-
238-
239211
class AccessLogger:
240212
"""Helper object to log access.
241213

0 commit comments

Comments
 (0)