Skip to content

gh-135500: Use ipaddress.ip_address instead of regex to detect IPv4 string in http.cookiejar #135502

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

Closed
wants to merge 5 commits into from

Conversation

LamentXU123
Copy link
Contributor

@LamentXU123 LamentXU123 commented Jun 14, 2025

@LamentXU123 LamentXU123 changed the title #gh-135500 Support IPv6 in http.cookiejar when deciding whether a string is a HDN or a IP address #gh-135500 Use ipaddress.ip_address instead of regex to detect IPv4 string in http.cookiejar Jun 14, 2025
@LamentXU123 LamentXU123 changed the title #gh-135500 Use ipaddress.ip_address instead of regex to detect IPv4 string in http.cookiejar gh-135500 Use ipaddress.ip_address instead of regex to detect IPv4 string in http.cookiejar Jun 14, 2025
@LamentXU123
Copy link
Contributor Author

LamentXU123 commented Jun 14, 2025

Well IMO, using ipaddress.ip_address is a better way to help us detect the IP string, either IPv4 and IPv6. It has a more precise judging method than regex. I think this could help us cope with possible bugs concerning false detections that consider IP string as a HDN which could lead to another comparing logic when Policy are dealing with banned domains. Note that ipaddress.ip_address will not cause a noticeable performance decline.

@picnixz picnixz changed the title gh-135500 Use ipaddress.ip_address instead of regex to detect IPv4 string in http.cookiejar gh-135500: Use ipaddress.ip_address instead of regex to detect IPv4 string in http.cookiejar Jun 14, 2025
@LamentXU123 LamentXU123 closed this by deleting the head repository Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant