httpdbg 0.7.2__tar.gz → 0.7.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 (56) hide show
  1. {httpdbg-0.7.2 → httpdbg-0.7.3}/PKG-INFO +3 -3
  2. {httpdbg-0.7.2 → httpdbg-0.7.3}/README.md +2 -2
  3. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/__init__.py +1 -1
  4. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/socket.py +23 -17
  5. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/records.py +5 -1
  6. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg.egg-info/PKG-INFO +3 -3
  7. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_hook_httpx.py +0 -18
  8. {httpdbg-0.7.2 → httpdbg-0.7.3}/LICENSE +0 -0
  9. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/__main__.py +0 -0
  10. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/args.py +0 -0
  11. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/__init__.py +0 -0
  12. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/aiohttp.py +0 -0
  13. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/all.py +0 -0
  14. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/httpx.py +0 -0
  15. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/requests.py +0 -0
  16. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/urllib3.py +0 -0
  17. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/hooks/utils.py +0 -0
  18. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/initiator.py +0 -0
  19. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/mode_console.py +0 -0
  20. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/mode_module.py +0 -0
  21. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/mode_script.py +0 -0
  22. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/server.py +0 -0
  23. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/utils.py +0 -0
  24. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/__init__.py +0 -0
  25. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/api.py +0 -0
  26. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/app.py +0 -0
  27. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/preview.py +0 -0
  28. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/api.js +0 -0
  29. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/column.css +0 -0
  30. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/configuration.js +0 -0
  31. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/detail.css +0 -0
  32. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/favicon.ico +0 -0
  33. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/filter.js +0 -0
  34. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/index.htm +0 -0
  35. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/main.js +0 -0
  36. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/mustache.min.js +0 -0
  37. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/render.js +0 -0
  38. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/style.css +0 -0
  39. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/table.css +0 -0
  40. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg/webapp/static/tooltip.css +0 -0
  41. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg.egg-info/SOURCES.txt +0 -0
  42. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg.egg-info/dependency_links.txt +0 -0
  43. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg.egg-info/entry_points.txt +0 -0
  44. {httpdbg-0.7.2 → httpdbg-0.7.3}/httpdbg.egg-info/top_level.txt +0 -0
  45. {httpdbg-0.7.2 → httpdbg-0.7.3}/pyproject.toml +0 -0
  46. {httpdbg-0.7.2 → httpdbg-0.7.3}/setup.cfg +0 -0
  47. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_api.py +0 -0
  48. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_cli.py +0 -0
  49. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_context_manager.py +0 -0
  50. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_hook_aiohttp.py +0 -0
  51. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_hook_requests.py +0 -0
  52. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_hook_urllib3.py +0 -0
  53. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_mode_console.py +0 -0
  54. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_mode_module_pytest.py +0 -0
  55. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_mode_script.py +0 -0
  56. {httpdbg-0.7.2 → httpdbg-0.7.3}/tests/test_preview.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: httpdbg
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: A very simple tool to debug HTTP(S) client requests
5
5
  Author-email: cle-b <cle@tictac.pm>
6
6
  License: Apache-2.0
@@ -86,8 +86,8 @@ pyhttpdbg -m pip install httpdbg --upgrade
86
86
  |------------|-------------|-------------------------------------------------------------------|
87
87
  | requests | supported | - |
88
88
  | urllib3 | supported | - |
89
- | httpx | supported | Async HTTPS requests not intercepted |
90
- | aiohttp | supported | HTTP requests not intercepted on Windows |
89
+ | httpx | supported | Async HTTP requests not intercepted on Windows (HTTPS OK) |
90
+ | aiohttp | supported | Async HTTP requests not intercepted on Windows (HTTPS OK) |
91
91
 
92
92
  ## configuration
93
93
 
@@ -66,8 +66,8 @@ pyhttpdbg -m pip install httpdbg --upgrade
66
66
  |------------|-------------|-------------------------------------------------------------------|
67
67
  | requests | supported | - |
68
68
  | urllib3 | supported | - |
69
- | httpx | supported | Async HTTPS requests not intercepted |
70
- | aiohttp | supported | HTTP requests not intercepted on Windows |
69
+ | httpx | supported | Async HTTP requests not intercepted on Windows (HTTPS OK) |
70
+ | aiohttp | supported | Async HTTP requests not intercepted on Windows (HTTPS OK) |
71
71
 
72
72
  ## configuration
73
73
 
@@ -2,6 +2,6 @@
2
2
  from httpdbg.hooks.all import httpdbg
3
3
  from httpdbg.utils import logger
4
4
 
5
- VERSION = "0.7.2"
5
+ VERSION = "0.7.3"
6
6
 
7
7
  __all__ = ["httpdbg", "logger"]
@@ -32,7 +32,9 @@ def set_hook_for_socket_connect(records, method):
32
32
  try:
33
33
  r = method(self, address)
34
34
  except Exception as ex:
35
- if not isinstance(ex, BlockingIOError): # for async
35
+ if not isinstance(
36
+ ex, (BlockingIOError, OSError)
37
+ ): # BlockingIOError for async, OSError for ipv6
36
38
  record = HTTPRecord()
37
39
  record.initiator = get_initiator(records._initiators)
38
40
 
@@ -61,11 +63,13 @@ def set_hook_for_ssl_wrap_socket(records, method):
61
63
 
62
64
  raise
63
65
 
66
+ logger.info(
67
+ f"WRAP_SOCKET - {type(sock)}={id(sock)} {type(sslsocket)}={id(sslsocket)}"
68
+ )
69
+
64
70
  socketdata = records.move_socket_data(sslsocket, sock)
65
71
  if socketdata:
66
- logger.info(
67
- f"WRAP_SOCKET - sock={sock} sockid={id(sock)} sslsocket={sslsocket} sslsocketid={id(sslsocket)} socketdata={socketdata}"
68
- )
72
+ logger.info(f"WRAP_SOCKET * - socketdata={socketdata}")
69
73
 
70
74
  return sslsocket
71
75
 
@@ -86,11 +90,13 @@ def set_hook_for_sslcontext_wrap_socket(records, method):
86
90
 
87
91
  raise
88
92
 
93
+ logger.info(
94
+ f"WRAP_SOCKET (SSLContext) - {type(self)}={id(self)} {type(sock)}={id(sock)} {type(sslsocket)}={id(sslsocket)}"
95
+ )
96
+
89
97
  socketdata = records.move_socket_data(sslsocket, sock)
90
98
  if socketdata:
91
- logger.info(
92
- f"WRAP_SOCKET (SSLContext) - socket={sock} socketid={id(sock)} sslsocket={sslsocket} sslsocketid={id(sslsocket)} socketdata={socketdata}"
93
- )
99
+ logger.info(f"WRAP_SOCKET (SSLContext) * - socketdata={socketdata}")
94
100
 
95
101
  return sslsocket
96
102
 
@@ -111,11 +117,13 @@ def set_hook_for_socket_wrap_bio(records, method):
111
117
 
112
118
  raise
113
119
 
114
- socketdata = records.move_socket_data(sslobject, self)
120
+ logger.info(
121
+ f"WRAP_SOCKET_BIO - {type(self)}={id(self)} {type(sslobject)}={id(sslobject)}"
122
+ )
123
+
124
+ socketdata = records.get_socket_data(sslobject, self)
115
125
  if socketdata:
116
- logger.info(
117
- f"WRAP_SOCKET_BIO - sock={self} sockid={id(self)} sslobject={sslobject} sslobjectid={id(sslobject)} socketdata={socketdata}"
118
- )
126
+ logger.info(f"WRAP_SOCKET_BIO * - socketdata={socketdata}")
119
127
 
120
128
  return sslobject
121
129
 
@@ -264,11 +272,10 @@ def set_hook_for_asyncio_create_connection(records, method):
264
272
 
265
273
  def set_hook_for_sslobject_write(records, method):
266
274
  def hook(self, buf, *args, **kwargs):
275
+ logger.info(f"WRITE - {type(self)}={id(self)} buf={(b'' + buf)[:20]}")
267
276
  socketdata = records.get_socket_data(self, request=True)
268
277
  if socketdata:
269
- logger.info(
270
- f"WRITE - self={self} id={id(self)} socketdata={socketdata} buf={(b'' + buf)[:20]} args={args} kwargs={kwargs}"
271
- )
278
+ logger.info(f"WRITE * - socketdata={socketdata}")
272
279
 
273
280
  try:
274
281
  size = method(self, buf, *args, **kwargs)
@@ -299,11 +306,10 @@ def set_hook_for_sslobject_write(records, method):
299
306
 
300
307
  def set_hook_for_sslobject_read(records, method):
301
308
  def hook(self, *args, **kwargs):
309
+ logger.info(f"READ - {type(self)}={id(self)}")
302
310
  socketdata = records.get_socket_data(self)
303
311
  if socketdata:
304
- logger.info(
305
- f"READ - self={self} id={id(self)} socketdata={socketdata} args={args} kwargs={kwargs}"
306
- )
312
+ logger.info(f"READ * - socketdata={socketdata}")
307
313
 
308
314
  try:
309
315
  r = method(self, *args, **kwargs)
@@ -97,7 +97,11 @@ class HTTPRecords:
97
97
  else:
98
98
  if extra_sock:
99
99
  try:
100
- address = extra_sock.getsockname()
100
+ address = (
101
+ extra_sock.getsockname()
102
+ if hasattr(extra_sock, "getsockname")
103
+ else ("", 0) # wrap_bio
104
+ )
101
105
  self._sockets[id(obj)] = SocketRawData(
102
106
  id(obj),
103
107
  address,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: httpdbg
3
- Version: 0.7.2
3
+ Version: 0.7.3
4
4
  Summary: A very simple tool to debug HTTP(S) client requests
5
5
  Author-email: cle-b <cle@tictac.pm>
6
6
  License: Apache-2.0
@@ -86,8 +86,8 @@ pyhttpdbg -m pip install httpdbg --upgrade
86
86
  |------------|-------------|-------------------------------------------------------------------|
87
87
  | requests | supported | - |
88
88
  | urllib3 | supported | - |
89
- | httpx | supported | Async HTTPS requests not intercepted |
90
- | aiohttp | supported | HTTP requests not intercepted on Windows |
89
+ | httpx | supported | Async HTTP requests not intercepted on Windows (HTTPS OK) |
90
+ | aiohttp | supported | Async HTTP requests not intercepted on Windows (HTTPS OK) |
91
91
 
92
92
  ## configuration
93
93
 
@@ -279,9 +279,6 @@ def test_httpx_many_requests_session():
279
279
  platform.system().lower() == "windows",
280
280
  reason="Async HTTP requests not intercepted on Windows",
281
281
  )
282
- @pytest.mark.xfail(
283
- reason="Async HTTPS requests not intercepted",
284
- )
285
282
  async def test_httpx_asyncclient(httpbin_both):
286
283
  with httpdbg() as records:
287
284
  async with httpx.AsyncClient(verify=False) as client:
@@ -326,9 +323,6 @@ async def test_httpx_initiator_asyncclient(httpbin):
326
323
  platform.system().lower() == "windows",
327
324
  reason="Async HTTP requests not intercepted on Windows",
328
325
  )
329
- @pytest.mark.xfail(
330
- reason="Async HTTPS requests not intercepted",
331
- )
332
326
  async def test_httpx_request_asyncclient(httpbin_both):
333
327
  with httpdbg() as records:
334
328
  async with httpx.AsyncClient(verify=False) as client:
@@ -351,9 +345,6 @@ async def test_httpx_request_asyncclient(httpbin_both):
351
345
  platform.system().lower() == "windows",
352
346
  reason="Async HTTP requests not intercepted on Windows",
353
347
  )
354
- @pytest.mark.xfail(
355
- reason="Async HTTPS requests not intercepted",
356
- )
357
348
  async def test_httpx_response_asyncclient(httpbin_both):
358
349
  with httpdbg() as records:
359
350
  async with httpx.AsyncClient(verify=False) as client:
@@ -411,9 +402,6 @@ async def test_httpx_cookies_asyncclient(httpbin):
411
402
  platform.system().lower() == "windows",
412
403
  reason="Async HTTP requests not intercepted on Windows",
413
404
  )
414
- @pytest.mark.xfail(
415
- reason="Async HTTPS requests not intercepted",
416
- )
417
405
  async def test_httpx_cookies_asyncclient_secure(httpbin_secure):
418
406
  with httpdbg() as records:
419
407
  async with httpx.AsyncClient(verify=False) as client:
@@ -467,9 +455,6 @@ async def test_httpx_exception_asyncclient():
467
455
  platform.system().lower() == "windows",
468
456
  reason="Async HTTP requests not intercepted on Windows",
469
457
  )
470
- @pytest.mark.xfail(
471
- reason="Async HTTPS requests not intercepted",
472
- )
473
458
  async def test_httpx_get_empty_request_content_asyncclient(httpbin_both):
474
459
  with httpdbg() as records:
475
460
  async with httpx.AsyncClient(verify=False) as client:
@@ -488,9 +473,6 @@ async def test_httpx_get_empty_request_content_asyncclient(httpbin_both):
488
473
  platform.system().lower() == "windows",
489
474
  reason="Async HTTP requests not intercepted on Windows",
490
475
  )
491
- @pytest.mark.xfail(
492
- reason="Async HTTPS requests not intercepted",
493
- )
494
476
  async def test_httpx_many_requests_session_asyncclient():
495
477
  with httpdbg() as records:
496
478
  async with httpx.AsyncClient() as session:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes