mirror of
https://github.com/django/daphne.git
synced 2024-11-25 09:13:44 +03:00
Fixed #86: Use left-most X-Forwarded-For value.
This commit is contained in:
parent
80bacf1ea1
commit
b8c96d7fb2
|
@ -46,7 +46,7 @@ class TestXForwardedForHttpParsing(TestCase):
|
|||
})
|
||||
self.assertEqual(
|
||||
parse_x_forwarded_for(headers),
|
||||
['10.1.2.4', 0]
|
||||
['10.1.2.3', 0]
|
||||
)
|
||||
|
||||
def test_original(self):
|
||||
|
|
|
@ -37,7 +37,7 @@ def parse_x_forwarded_for(headers,
|
|||
address_value = header_value(headers, address_header_name)
|
||||
|
||||
if ',' in address_value:
|
||||
address_value = address_value.split(",")[-1].strip()
|
||||
address_value = address_value.split(",")[0].strip()
|
||||
|
||||
if ':' in address_value:
|
||||
address_host, address_port = address_value.split(':')
|
||||
|
|
Loading…
Reference in New Issue
Block a user