Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 in X-Forwarded-For fix #6062

Merged
merged 2 commits into from
Aug 9, 2019
Merged

IPv6 in X-Forwarded-For fix #6062

merged 2 commits into from
Aug 9, 2019

Conversation

davidfischer
Copy link
Contributor

It's unclear to me whether our production proxies would ever include an IPv6 with port. In the errors I'm seeing in prod, I don't see that. X-Forwarded-For is not exactly a standard so there isn't something to look up here.

@davidfischer davidfischer requested review from dojutsu-user and a team August 9, 2019 17:03
Copy link
Member

@dojutsu-user dojutsu-user left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

# only client's ip is present
request = RequestFactory().get('/')
request.META['HTTP_X_FORWARDED_FOR'] = '203.0.113.195'
client_ip = get_client_ip(request)
self.assertEqual(client_ip, '203.0.113.195')

# only client's ip is present
request = RequestFactory().get('/')
ip = '2001:abc:def:012:345:6789:abcd:ef12'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get the sample ip?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just created it. You can always test if it's a valid IP (it is) with the ipaddress module.

@ericholscher ericholscher added the PR: hotfix Pull request applied as hotfix to release label Aug 9, 2019
@ericholscher
Copy link
Member

Hotfixed to rel.

@davidfischer davidfischer merged commit e53af66 into master Aug 9, 2019
@davidfischer davidfischer deleted the davidfischer/ipv6-fix branch August 9, 2019 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: hotfix Pull request applied as hotfix to release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants