wheezy.http 3.2.2__tar.gz → 3.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {wheezy_http-3.2.2/src/wheezy.http.egg-info → wheezy_http-3.2.3}/PKG-INFO +2 -2
  2. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/pyproject.toml +1 -1
  3. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/__init__.py +1 -1
  4. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/middleware.py +21 -7
  5. {wheezy_http-3.2.2 → wheezy_http-3.2.3/src/wheezy.http.egg-info}/PKG-INFO +2 -2
  6. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy.http.egg-info/requires.txt +1 -1
  7. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/LICENSE +0 -0
  8. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/MANIFEST.in +0 -0
  9. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/README.md +0 -0
  10. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/setup.cfg +0 -0
  11. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/setup.py +0 -0
  12. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/_cgi.py +0 -0
  13. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/application.py +0 -0
  14. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/authorization.py +0 -0
  15. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/cache.py +0 -0
  16. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/cachepolicy.py +0 -0
  17. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/cacheprofile.py +0 -0
  18. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/config.py +0 -0
  19. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/cookie.py +0 -0
  20. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/functional.py +0 -0
  21. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/method.py +0 -0
  22. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/parse.py +0 -0
  23. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/request.py +0 -0
  24. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/response.py +0 -0
  25. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy/http/transforms.py +0 -0
  26. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy.http.egg-info/SOURCES.txt +0 -0
  27. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy.http.egg-info/dependency_links.txt +0 -0
  28. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy.http.egg-info/not-zip-safe +0 -0
  29. {wheezy_http-3.2.2 → wheezy_http-3.2.3}/src/wheezy.http.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wheezy.http
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: A lightweight http request-response library
5
5
  Author-email: Andriy Kornatskyy <andriy.kornatskyy@live.com>
6
6
  License-Expression: MIT
@@ -31,7 +31,7 @@ Classifier: Topic :: Software Development :: Testing
31
31
  Requires-Python: >=3.10
32
32
  Description-Content-Type: text/markdown
33
33
  License-File: LICENSE
34
- Requires-Dist: wheezy.core>=3.2.2
34
+ Requires-Dist: wheezy.core>=3.2.3
35
35
  Provides-Extra: cython
36
36
  Requires-Dist: Cython>=3.0; extra == "cython"
37
37
  Requires-Dist: setuptools>=61.0; extra == "cython"
@@ -45,7 +45,7 @@ classifiers = [
45
45
  "Topic :: Software Development :: Quality Assurance",
46
46
  "Topic :: Software Development :: Testing",
47
47
  ]
48
- dependencies = ["wheezy.core>=3.2.2"]
48
+ dependencies = ["wheezy.core>=3.2.3"]
49
49
 
50
50
  [project.optional-dependencies]
51
51
  cython = ["Cython>=3.0", "setuptools>=61.0"]
@@ -67,4 +67,4 @@ __all__ = (
67
67
  "temporary_redirect",
68
68
  "unauthorized",
69
69
  )
70
- __version__ = "3.2.2"
70
+ __version__ = "3.2.3"
@@ -1,3 +1,5 @@
1
+ from datetime import timezone
2
+
1
3
  from wheezy.core.datetime import parse_http_datetime
2
4
 
3
5
  from wheezy.http.cache import (
@@ -8,6 +10,8 @@ from wheezy.http.cache import (
8
10
  from wheezy.http.cacheprofile import RequestVary
9
11
  from wheezy.http.response import HTTPResponse
10
12
 
13
+ UTC = timezone.utc
14
+
11
15
 
12
16
  class HTTPCacheMiddleware(object):
13
17
  """HTTP cache middleware."""
@@ -28,7 +32,7 @@ class HTTPCacheMiddleware(object):
28
32
  self.key = middleware_vary.key
29
33
  self.profiles = {}
30
34
 
31
- def __call__(self, request, following):
35
+ def __call__(self, request, following): # noqa: C901
32
36
  middleware_key = self.key(request)
33
37
  if middleware_key in self.profiles:
34
38
  cache_profile = self.profiles[middleware_key]
@@ -42,10 +46,15 @@ class HTTPCacheMiddleware(object):
42
46
  elif (
43
47
  response.last_modified
44
48
  and "HTTP_IF_MODIFIED_SINCE" in environ
45
- and parse_http_datetime(environ["HTTP_IF_MODIFIED_SINCE"])
46
- >= response.last_modified
47
49
  ):
48
- return NotModifiedResponse(response)
50
+ modified_since = parse_http_datetime(
51
+ environ["HTTP_IF_MODIFIED_SINCE"]
52
+ )
53
+ if modified_since is not None and (
54
+ modified_since.replace(tzinfo=UTC)
55
+ >= response.last_modified
56
+ ):
57
+ return NotModifiedResponse(response)
49
58
  return response
50
59
  response = following(request)
51
60
  if response and response.status_code == 200:
@@ -94,10 +103,15 @@ class HTTPCacheMiddleware(object):
94
103
  elif (
95
104
  cacheable.last_modified
96
105
  and "HTTP_IF_MODIFIED_SINCE" in environ
97
- and parse_http_datetime(environ["HTTP_IF_MODIFIED_SINCE"])
98
- >= cacheable.last_modified
99
106
  ):
100
- return NotModifiedResponse(response)
107
+ modified_since = parse_http_datetime(
108
+ environ["HTTP_IF_MODIFIED_SINCE"]
109
+ )
110
+ if modified_since is not None and (
111
+ modified_since.replace(tzinfo=UTC)
112
+ >= cacheable.last_modified
113
+ ):
114
+ return NotModifiedResponse(response)
101
115
  # the response already has all necessary headers
102
116
  return SurfaceResponse(response)
103
117
  return response
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wheezy.http
3
- Version: 3.2.2
3
+ Version: 3.2.3
4
4
  Summary: A lightweight http request-response library
5
5
  Author-email: Andriy Kornatskyy <andriy.kornatskyy@live.com>
6
6
  License-Expression: MIT
@@ -31,7 +31,7 @@ Classifier: Topic :: Software Development :: Testing
31
31
  Requires-Python: >=3.10
32
32
  Description-Content-Type: text/markdown
33
33
  License-File: LICENSE
34
- Requires-Dist: wheezy.core>=3.2.2
34
+ Requires-Dist: wheezy.core>=3.2.3
35
35
  Provides-Extra: cython
36
36
  Requires-Dist: Cython>=3.0; extra == "cython"
37
37
  Requires-Dist: setuptools>=61.0; extra == "cython"
@@ -1,4 +1,4 @@
1
- wheezy.core>=3.2.2
1
+ wheezy.core>=3.2.3
2
2
 
3
3
  [cython]
4
4
  Cython>=3.0
File without changes
File without changes
File without changes
File without changes
File without changes