diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f722a6e..26377b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9] + python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9] steps: - uses: actions/checkout@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cc2260..685fed6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## 2.0.1 +Issue: +- Remove `HTTP_VIA` header support (unreliable IP information) (@yourcelf) + +Enhance: +- Include support for python 3.12 + ## 2.0.0 - Introduced breaking changes to avoid conflicts with the `django-ipware` package. diff --git a/README.md b/README.md index 048ef39..74ebb29 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,6 @@ request_headers_precedence_order = ( "HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray "HTTP_FORWARDED_FOR", # RFC 7239 "HTTP_FORWARDED", # RFC 7239 - "HTTP_VIA", # Squid and others "X-CLIENT-IP", # Microsoft Azure "X-REAL-IP", # NGINX "X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers diff --git a/pyproject.toml b/pyproject.toml index a0e6c4c..ad4c5e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] [project.urls] diff --git a/python_ipware/__version__.py b/python_ipware/__version__.py index 8c0d5d5..159d48b 100644 --- a/python_ipware/__version__.py +++ b/python_ipware/__version__.py @@ -1 +1 @@ -__version__ = "2.0.0" +__version__ = "2.0.1" diff --git a/python_ipware/python_ipware.py b/python_ipware/python_ipware.py index 6e4f6f1..f4d730d 100644 --- a/python_ipware/python_ipware.py +++ b/python_ipware/python_ipware.py @@ -26,7 +26,6 @@ def __init__( "HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray "HTTP_FORWARDED_FOR", # RFC 7239 "HTTP_FORWARDED", # RFC 7239 - "HTTP_VIA", # Squid and others "X-CLIENT-IP", # Microsoft Azure "X-REAL-IP", # NGINX "X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers @@ -106,7 +105,7 @@ def get_ip_object( ip = ipaddress.IPv4Address(ipv4) except ipaddress.AddressValueError: # not a valid IP address, return None - logging.exception("Invalid ip address. {0}".format(ip_str)) + logging.info("Invalid ip address. {0}".format(ip_str)) ip = None return ip diff --git a/tests/tests_ipv4.py b/tests/tests_ipv4.py index 277c7c3..6a173a3 100644 --- a/tests/tests_ipv4.py +++ b/tests/tests_ipv4.py @@ -364,13 +364,6 @@ def test_ipv4_http_http_forwarded(self): r = self.ipware.get_client_ip(meta) self.assertEqual(r, (IPv4Address("177.139.233.139"), False)) - def test_ipv4_http_via(self): - meta = { - "HTTP_VIA": "177.139.233.139", - } - r = self.ipware.get_client_ip(meta) - self.assertEqual(r, (IPv4Address("177.139.233.139"), False)) - def test_ipv4_x_client_ip(self): meta = { "X-CLIENT-IP": "177.139.233.139",