Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all messages are suppressed with --quiet --quiet or -qq #1271

Closed
2 tasks done
alexdelorenzo opened this issue Jan 21, 2022 · 2 comments · Fixed by #1283
Closed
2 tasks done

Not all messages are suppressed with --quiet --quiet or -qq #1271

alexdelorenzo opened this issue Jan 21, 2022 · 2 comments · Fixed by #1283
Assignees
Labels
bug Something isn't working

Comments

@alexdelorenzo
Copy link

Checklist

  • I've searched for similar issues.
  • I'm using the latest version of HTTPie.

Minimal reproduction code and steps

$  http --quiet --quiet --check-status \
    "https://al.mirror.kumi.systems/ubuntu/dists/focal/main/binary-amd64/"

Current result

$  http --quiet --quiet --check-status \
    "https://al.mirror.kumi.systems/ubuntu/dists/focal/main/binary-amd64/"

http: error: SSLError: HTTPSConnectionPool(host='al.mirror.kumi.systems', port=443): Max retries exceeded with url: /ubuntu//dists/focal/main/binary-amd64/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)'))) while doing a GET request to URL: https://al.mirror.kumi.systems/ubuntu//dists/focal/main/binary-amd64/

Expected result

I'd expect the double --quiet flag to suppress all warnings.


Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

$ http --debug --quiet --quiet --check-status "https://al.mirror.kumi.systems/ubuntu//dists/focal/main/binary-amd64/" 2>&1
HTTPie 2.6.0
Requests 2.26.0
Pygments 2.11.2
Python 3.10.1 (main, Dec 18 2021, 23:53:45) [GCC 11.1.0]
/usr/bin/python3
Linux 5.15.15-1-MANJARO

<Environment {'colors': 256,
 'config': {'default_options': []},
 'config_dir': PosixPath('/home/alex/.config/httpie'),
 'devnull': <property object at 0x7f552e0e3fb0>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x7f552e0d2680>,
 'program_name': 'http',
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
 'stderr_isatty': False,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
 'stdin_encoding': 'utf-8',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
 'stdout_encoding': 'utf-8',
 'stdout_isatty': False}>

<PluginManager {'adapters': [],
 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
          <class 'httpie.plugins.builtin.DigestAuthPlugin'>],
 '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': None,
 'data': RequestJSONDataDict(),
 'headers': {'User-Agent': b'HTTPie/2.6.0'},
 'method': 'get',
 'params': <generator object MultiValueOrderedDict.items at 0x7f552d93f0d0>,
 'url': 'https://al.mirror.kumi.systems/ubuntu//dists/focal/main/binary-amd64/'})


http: error: SSLError: HTTPSConnectionPool(host='al.mirror.kumi.systems', port=443): Max retries exceeded with url: /ubuntu//dists/focal/main/binary-amd64/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)'))) while doing a GET request to URL: https://al.mirror.kumi.systems/ubuntu//dists/focal/main/binary-amd64/

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
    conn.connect()
  File "/usr/lib/python3.10/site-packages/urllib3/connection.py", line 416, in connect
    self.sock = ssl_wrap_socket(
  File "/usr/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(
  File "/usr/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.10/ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.10/ssl.py", line 1070, in _create
    self.do_handshake()
  File "/usr/lib/python3.10/ssl.py", line 1341, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.10/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/lib/python3.10/site-packages/urllib3/util/retry.py", line 574, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='al.mirror.kumi.systems', port=443): Max retries exceeded with url: /ubuntu//dists/focal/main/binary-amd64/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/http", line 33, in <module>
    sys.exit(load_entry_point('httpie==2.6.0', 'console_scripts', 'http')())
  File "/usr/lib/python3.10/site-packages/httpie/__main__.py", line 9, in main
    exit_status = main()
  File "/usr/lib/python3.10/site-packages/httpie/core.py", line 70, in main
    exit_status = program(
  File "/usr/lib/python3.10/site-packages/httpie/core.py", line 169, in program
    for message in messages:
  File "/usr/lib/python3.10/site-packages/httpie/client.py", line 102, in collect_messages
    response = requests_session.send(
  File "/usr/lib/python3.10/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.10/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='al.mirror.kumi.systems', port=443): Max retries exceeded with url: /ubuntu//dists/focal/main/binary-amd64/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)')))
@alexdelorenzo alexdelorenzo added bug Something isn't working new Needs triage. Comments are welcome! labels Jan 21, 2022
@alexdelorenzo
Copy link
Author

I'm also encountering cases where httpie will still print 404 warnings to the console despite launching it with double quiet flags. I can't reproduce it consistently, though. It seems to only occasionally happen when making many concurrent connections from the shell with GNU parallel and the http CLI.

@jkbrzt
Copy link
Member

jkbrzt commented Jan 22, 2022

Thanks for the report! @isidentical looks like we need to also disable Python’s warnings to hide warnings triggered in 3rd-party packages.

@jkbrzt jkbrzt added help wanted Extra attention is needed and removed new Needs triage. Comments are welcome! labels Jan 22, 2022
@isidentical isidentical self-assigned this Jan 31, 2022
@jkbrzt jkbrzt removed the help wanted Extra attention is needed label Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants