Skip to content

Commit ad1f017

Browse files
authored
Remove HTTP_VIA support, support for 3.12 (#14)
* Remove HTTP_VIA * up version * add py 3.12
1 parent 07840b9 commit ad1f017

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, pypy3.9]
23+
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9]
2424

2525
steps:
2626
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2.0.1
2+
Issue:
3+
- Remove `HTTP_VIA` header support (unreliable IP information) (@yourcelf)
4+
5+
Enhance:
6+
- Include support for python 3.12
7+
18
## 2.0.0
29

310
- Introduced breaking changes to avoid conflicts with the `django-ipware` package.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ request_headers_precedence_order = (
103103
"HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray
104104
"HTTP_FORWARDED_FOR", # RFC 7239
105105
"HTTP_FORWARDED", # RFC 7239
106-
"HTTP_VIA", # Squid and others
107106
"X-CLIENT-IP", # Microsoft Azure
108107
"X-REAL-IP", # NGINX
109108
"X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ classifiers = [
2626
"Programming Language :: Python :: 3.9",
2727
"Programming Language :: Python :: 3.10",
2828
"Programming Language :: Python :: 3.11",
29+
"Programming Language :: Python :: 3.12",
2930
]
3031

3132
[project.urls]

python_ipware/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.0"
1+
__version__ = "2.0.1"

python_ipware/python_ipware.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ def __init__(
2626
"HTTP_X_CLUSTER_CLIENT_IP", # Rackspace LB and Riverbed Stingray
2727
"HTTP_FORWARDED_FOR", # RFC 7239
2828
"HTTP_FORWARDED", # RFC 7239
29-
"HTTP_VIA", # Squid and others
3029
"X-CLIENT-IP", # Microsoft Azure
3130
"X-REAL-IP", # NGINX
3231
"X-CLUSTER-CLIENT-IP", # Rackspace Cloud Load Balancers
@@ -106,7 +105,7 @@ def get_ip_object(
106105
ip = ipaddress.IPv4Address(ipv4)
107106
except ipaddress.AddressValueError:
108107
# not a valid IP address, return None
109-
logging.exception("Invalid ip address. {0}".format(ip_str))
108+
logging.info("Invalid ip address. {0}".format(ip_str))
110109
ip = None
111110
return ip
112111

tests/tests_ipv4.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,6 @@ def test_ipv4_http_http_forwarded(self):
364364
r = self.ipware.get_client_ip(meta)
365365
self.assertEqual(r, (IPv4Address("177.139.233.139"), False))
366366

367-
def test_ipv4_http_via(self):
368-
meta = {
369-
"HTTP_VIA": "177.139.233.139",
370-
}
371-
r = self.ipware.get_client_ip(meta)
372-
self.assertEqual(r, (IPv4Address("177.139.233.139"), False))
373-
374367
def test_ipv4_x_client_ip(self):
375368
meta = {
376369
"X-CLIENT-IP": "177.139.233.139",

0 commit comments

Comments
 (0)