httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
32.74k stars 3.68k forks source link

Potential issue httpie 3.2.1 on macos Ventura #1451

Closed aquacode closed 1 year ago

aquacode commented 1 year ago

After upgrading, GET requests using basic auth are taking upwards of 3 minutes to return a 200 response. If I do the same exact request using the web version of httpie, the response is near immediate. The only thing different on my machine is that I recently upgraded to Ventura. Is there any other debug, or troubleshooting I could perform to find the issue? It's not my 'network' since the web version of httpie works perfectly (as does curl and Postman).

jkbrzt commented 1 year ago

@aquacode could you please share the URL, if not sensitive, and the output of http --debug?

aquacode commented 1 year ago

https -v --debug -A basic -a username:app_password https://api.bitbucket.org/2.0/repositories/{workspaace}/{repository_slug}/environments/ HTTPie 3.2.1 Requests 2.27.1 Pygments 2.12.0 Python 3.10.6 (main, Aug 30 2022, 05:12:36) [Clang 13.1.6 (clang-1316.0.21.2.5)] /usr/local/Cellar/httpie/3.2.1/libexec/bin/python3.10 Darwin 22.1.0

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x1057daa70>, 'args': Namespace(), 'as_silent': <function Environment.as_silent at 0x1057da950>, 'colors': 256, 'config': {'default_options': []}, 'config_dir': PosixPath('/Users/{user}/.config/httpie'), 'devnull': <property object at 0x1057ec3b0>, 'is_windows': False, 'log_error': <function Environment.log_error at 0x1057da9e0>, 'program_name': 'https', 'quiet': 0, 'rich_console': <functools.cached_property object at 0x1057ba260>, 'rich_error_console': <functools.cached_property object at 0x1057bbd90>, 'show_displays': True, 'stderr': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'stderr_isatty': True, 'stdin': <_io.TextIOWrapper name='' mode='r' encoding='utf-8'>, 'stdin_encoding': 'utf-8', 'stdin_isatty': True, 'stdout': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'stdout_encoding': 'utf-8', 'stdout_isatty': True}>

<PluginManager {'adapters': [], 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>, <class 'httpie.plugins.builtin.DigestAuthPlugin'>, <class 'httpie.plugins.builtin.BearerAuthPlugin'>], 'converters': [], 'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>, <class 'httpie.output.formatters.json.JSONFormatter'>, <class 'httpie.output.formatters.xml.XMLFormatter'>, <class 'httpie.output.formatters.colors.ColorFormatter'>]}>

requests.request(**{'auth': <httpie.plugins.builtin.HTTPBasicAuth object at 0x105afdd20>, 'data': RequestJSONDataDict(), 'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.1')>, 'method': 'get', 'params': <generator object MultiValueOrderedDict.items at 0x105adb5a0>, 'url': 'https://api.bitbucket.org/2.0/repositories/{workspace}/{repository_slug}/environments/'})

GET /2.0/repositories/{workspace}/{repository_slug}/environments/ HTTP/1.1 Accept: / Accept-Encoding: gzip, deflate Authorization: Basic {basic_auth_token} Connection: keep-alive Host: api.bitbucket.org User-Agent: HTTPie/3.2.1

HTTP/1.1 200 OK Connection: keep-alive Content-Encoding: gzip Content-Type: application/json; charset=utf-8 Date: Mon, 14 Nov 2022 22:08:53 GMT ETag: "cb9c82bf1acb2ed5a82aa27c2c0ee70e" Server: nginx Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Transfer-Encoding: chunked Vary: Origin X-B3-Parentspanid: 2b55bac96ab9b156 X-B3-Spanid: c7d07629fee11c0d, b66048d2096ebbe1 X-B3-TraceId: 8880651d717ce3d8 X-Cache: Miss from cloudfront X-Content-Type-Options: nosniff X-Credential-Type: apppassword X-Dc-Location: Micros-3 X-Frame-Options: SAMEORIGIN X-OAuth-Scopes: pipeline:variable X-Render-Time: 0.7083451747894287 X-Request-Count: 3327 X-Served-By: b572739c08f7 X-Static-Version: ebf90d4ef404 X-Trace-Id: 8880651d717ce3d8 X-Usage-Input-Ops: 0 X-Usage-Output-Ops: 0 X-Usage-System-Time: 0.003571 X-Usage-User-Time: 0.372433 X-Used-Mesh: False X-Version: ebf90d4ef404 X-View-Name: bitbucket.apps.proxy.views.proxypass X-XSS-Protection: 1; mode=block x-request-id: 8880651d717ce3d8

The above is GET request and URL with my private data replaced with variable names and the --debug flag the response minus the actual JSON payload

This took about 3 minutes to respond

Interestingly, if I run this same request in Python directly, it's the same result, over 3 minutes, but a successful 200

aquacode commented 1 year ago

Ok, I think I may have found the resolution. I came upon this post https://matduggan.com/til-python-3-6-and-up-is-broken-on-mac/ and tried it and now HTTPie/python/requests/urlib3 all respond in milliseconds.

jkbrzt commented 1 year ago

That’s great, thanks for sharing!