httpie / httpie-http2

(DEPRECATED) Experimental HTTP/2 plugin for HTTPie
https://httpie.org
Other
68 stars 4 forks source link

--verify=no doesn't work #7

Closed nhooyr closed 8 years ago

nhooyr commented 8 years ago
HTTPie 1.0.0-dev
Requests 2.9.1
Pygments 2.1.3
Python 2.7.11 (default, Jan 22 2016, 08:29:18) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
/usr/local/opt/python/bin/python2.7
Darwin 15.4.0

<Environment {
    "colors": 256, 
    "config": {
        "__meta__": {
            "about": "u'HTTPie configuration file'", 
            "help": "u'https://github.com/jkbrzt/httpie#config'", 
            "httpie": "u'1.0.0-dev'"
        }, 
        "default_options": "[u'--style=bw']"
    }, 
    "config_dir": "/Users/nhooyr/.httpie", 
    "is_windows": false, 
    "stderr": "<open file '<stderr>', mode 'w' at 0x1018f41e0>", 
    "stderr_isatty": false, 
    "stdin": "<open file '<stdin>', mode 'r' at 0x1018f40c0>", 
    "stdin_encoding": "UTF-8", 
    "stdin_isatty": true, 
    "stdout": "<open file '<stdout>', mode 'w' at 0x1018f4150>", 
    "stdout_encoding": "utf8", 
    "stdout_isatty": false
}>

>>> requests.request(**{
    "allow_redirects": false, 
    "auth": "None", 
    "cert": "None", 
    "data": {}, 
    "files": {}, 
    "headers": {
        "User-Agent": "HTTPie/1.0.0-dev"
    }, 
    "method": "get", 
    "params": {}, 
    "proxies": {}, 
    "stream": true, 
    "timeout": 30, 
    "url": "u'https://localhost'", 
    "verify": false
})

http: error: SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
Traceback (most recent call last):
  File "/usr/local/bin/http", line 9, in <module>
    load_entry_point('httpie==1.0.0.dev0', 'console_scripts', 'http')()
  File "/usr/local/lib/python2.7/site-packages/httpie/core.py", line 227, in main
    log_error=log_error,
  File "/usr/local/lib/python2.7/site-packages/httpie/core.py", line 99, in program
    final_response = get_response(args, config_dir=env.config.directory)
  File "/usr/local/lib/python2.7/site-packages/httpie/client.py", line 70, in get_response
    response = requests_session.request(**kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/hyper/contrib.py", line 66, in send
    request.headers
  File "/usr/local/lib/python2.7/site-packages/hyper/common/connection.py", line 98, in request
    method=method, url=url, body=body, headers=headers
  File "/usr/local/lib/python2.7/site-packages/hyper/http11/connection.py", line 164, in request
    self.connect()
  File "/usr/local/lib/python2.7/site-packages/hyper/http11/connection.py", line 128, in connect
    sock, proto = wrap_socket(sock, host, self.ssl_context)
  File "/usr/local/lib/python2.7/site-packages/hyper/tls.py", line 42, in wrap_socket
    ssl_sock = _ssl_context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
Lukasa commented 8 years ago

Right now hyper does not respect the verification settings from httpie or from requests.

jkbrzt commented 8 years ago

@Lukasa thanks for the information.

@nhooyr Please follow the development of this issue under https://github.com/Lukasa/hyper (and https://github.com/jkbrzt/httpie-http2)

guoxiao commented 8 years ago

If this issue still exists, should we keep it open rather than closing it?

thomasleveil commented 6 years ago

Installing hyper from the HEAD of their master branch fix this issue as explained on https://github.com/Lukasa/hyper/issues/340#issuecomment-313605703

pip install -U git+https://github.com/Lukasa/hyper.git
Fuxy22 commented 5 years ago

This is still broken for me if i use the latest httpie-http2 with httpie from pip. Works just fine if i only use httpie alone.