Skip to content

Commit

Permalink
Remove HTTP_VIA support, support for 3.12 (#14)
Browse files Browse the repository at this point in the history
* Remove HTTP_VIA
* up version
* add py 3.12
  • Loading branch information
un33k authored Dec 13, 2023
1 parent 07840b9 commit ad1f017
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion python_ipware/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.0.0"
__version__ = "2.0.1"
3 changes: 1 addition & 2 deletions python_ipware/python_ipware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions tests/tests_ipv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ad1f017

Please sign in to comment.