geventhttpclient 2.3.8__tar.gz → 2.3.9__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 (42) hide show
  1. {geventhttpclient-2.3.8/src/geventhttpclient.egg-info → geventhttpclient-2.3.9}/PKG-INFO +1 -1
  2. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/pyproject.toml +1 -1
  3. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/__init__.py +1 -1
  4. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/connectionpool.py +14 -11
  5. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9/src/geventhttpclient.egg-info}/PKG-INFO +1 -1
  6. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/LICENSE-MIT +0 -0
  7. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/MANIFEST.in +0 -0
  8. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/README.md +0 -0
  9. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/ext/Python_compat.h +0 -0
  10. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/ext/_parser.c +0 -0
  11. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/llhttp/LICENSE-MIT +0 -0
  12. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/llhttp/include/llhttp.h +0 -0
  13. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/llhttp/src/api.c +0 -0
  14. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/llhttp/src/http.c +0 -0
  15. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/llhttp/src/llhttp.c +0 -0
  16. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/setup.cfg +0 -0
  17. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/setup.py +0 -0
  18. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/api.py +0 -0
  19. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/client.py +0 -0
  20. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/header.py +0 -0
  21. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/httplib.py +0 -0
  22. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/httplib2.py +0 -0
  23. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/requests.py +0 -0
  24. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/response.py +0 -0
  25. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/url.py +0 -0
  26. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient/useragent.py +0 -0
  27. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient.egg-info/SOURCES.txt +0 -0
  28. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient.egg-info/dependency_links.txt +0 -0
  29. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient.egg-info/requires.txt +0 -0
  30. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/src/geventhttpclient.egg-info/top_level.txt +0 -0
  31. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_client.py +0 -0
  32. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_headers.py +0 -0
  33. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_httplib.py +0 -0
  34. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_httplib2.py +0 -0
  35. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_keep_alive.py +0 -0
  36. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_network_failures.py +0 -0
  37. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_no_module_ssl.py +0 -0
  38. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_parser.py +0 -0
  39. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_requests.py +0 -0
  40. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_ssl.py +0 -0
  41. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_url.py +0 -0
  42. {geventhttpclient-2.3.8 → geventhttpclient-2.3.9}/tests/test_useragent.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geventhttpclient
3
- Version: 2.3.8
3
+ Version: 2.3.9
4
4
  Summary: HTTP client library for gevent
5
5
  Author-email: Antonin Amand <antonin.amand@gmail.com>
6
6
  License-Expression: MIT
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "geventhttpclient"
8
- version = "2.3.8" # don't forget to update version __init__.py as well
8
+ version = "2.3.9" # don't forget to update version __init__.py as well
9
9
  description = "HTTP client library for gevent"
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.9"
@@ -1,6 +1,6 @@
1
1
  # package
2
2
 
3
- __version__ = "2.3.8" # don't forget to update version in pyproject.toml as well
3
+ __version__ = "2.3.9" # don't forget to update version in pyproject.toml as well
4
4
 
5
5
  from geventhttpclient.api import delete, get, head, options, patch, post, put, request
6
6
  from geventhttpclient.client import HTTPClient
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import socket
3
+ import select
3
4
 
4
5
  import gevent.queue
5
6
  import gevent.socket
@@ -151,24 +152,26 @@ class ConnectionPool:
151
152
  raise RuntimeError(f"Error response from Proxy server : {resp}")
152
153
 
153
154
  def _is_socket_alive(self, sock):
154
- """check if a socket is still connected and alive.
155
+ """Check if a socket is still connected and alive.
155
156
 
156
- uses MSG_PEEK | MSG_DONTWAIT to check for eof without consuming data,
157
- and without blocking.
157
+ Uses select() to check if socket is readable. An idle keep-alive socket
158
+ should NOT be readable.
158
159
 
159
- returns false if connection is closed or broken.
160
+ Returns False if connection is closed or broken.
160
161
  """
162
+ if sock is None:
163
+ return False
161
164
  try:
162
- raw_sock = getattr(sock, "_sock", sock)
163
- if raw_sock.fileno() < 0:
165
+ # Proactive check: A closed socket has a fileno of -1.
166
+ if sock.fileno() < 0:
164
167
  return False
165
- data = raw_sock.recv(1, socket.MSG_PEEK | socket.MSG_DONTWAIT)
166
- if data == b"":
168
+ # If the socket is readable while idle, it's either a FIN or dirty.
169
+ ready_to_read, _, _ = select.select([sock], [], [], 0.0)
170
+ if ready_to_read:
167
171
  return False
172
+
168
173
  return True
169
- except BlockingIOError:
170
- return True
171
- except OSError:
174
+ except (OSError, ValueError, socket.error):
172
175
  return False
173
176
 
174
177
  def get_socket(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: geventhttpclient
3
- Version: 2.3.8
3
+ Version: 2.3.9
4
4
  Summary: HTTP client library for gevent
5
5
  Author-email: Antonin Amand <antonin.amand@gmail.com>
6
6
  License-Expression: MIT