Closed matiaskorhonen closed 9 years ago
Yes, this seems to be related to SNI. You can either upgrade to Python 2.7.9 or 3.4, or manually install some dependencies, if you are stuck with an older Python version:
https://github.com/jakubroztocil/httpie#sni-server-name-indication
$ python --version
Python 2.7.9
$ http --verify=no --verbose HEAD https://matiaskorhonen.fi
HEAD / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: matiaskorhonen.fi
User-Agent: HTTPie/1.0.0-dev
HTTP/1.1 200 OK
Alternate-Protocol: 443:npn-spdy/2
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Wed, 06 May 2015 21:17:32 GMT
Last-Modified: Tue, 05 May 2015 19:25:22 GMT
Server: nginx
Vary: Accept-Encoding
I got it to work with Python 3.
Cheers.
I get this issue as well, using python 2.7.11 under OSX. I tried both pip and brew versions.
The equivalent curl command has no issue.
httpie version 0.9.3
@kyteague is it a public URL?
@jkbrzt no, unfortunately it's a private API.
If it's helpful -- the server uses nginx (https -- no spdy) using the following settings: ssl_protocols TLSv1.1 TLSv1.2; ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m;
This reverse proxies to a webservice written in Go.
@kyteague Not sure what the issue is yet, but I'm only able to reproduce it on Python 2.7.10. It works fine on Python 2.7.11. I think you're on Python 2.7.10, too.
I found the issue.
The http
script hardcodes #!/usr/bin/python
instead of the canonical #!/usr/bin/env python
This caused python 2.7.10 (from OSX) to be used instead of 2.7.11 (my default python from brew). 2.7.10 has the connection issue, while 2.7.11 does not.
This should definitely be patched as the latter #!/usr/bin/env python
more accurately describes the location of the system python executable.
@kyteague Yeah, the formula currently uses the system Python 2.7 which has some issues. I'm now testing a Python3-based formula which I'm considering for the next release to avoid issues like that. Feel free to give it a try:
$ brew install https://gist.githubusercontent.com/jkbrzt/e59a0cde6ae6f59f2182/raw/httpie.rb
@jkbrzt works as expected! thanks!
Installed httpie-ntlm with Python3, and that worked (on my MacOSX)
sudo python3 setup.py install
@jakubroztocil I tried the one you suggested but it has thrown the below error. VJ:audit vijay.dugini$ brew install https://gist.githubusercontent.com/jkbrzt/e59a0cde6ae6f59f2182/raw/httpie.rb
curl: (22) The requested URL returned error: 404 Not Found Error: Failure while executing: /usr/bin/curl --show-error --user-agent Homebrew/1.3.2\ (Macintosh;\ Intel\ Mac\ OS\ X\ 10.12.6)\ curl/7.54.0 --fail --progress-bar --location --remote-time --continue-at - --output /Users/vijay.dugini/Library/Caches/Homebrew/Formula/httpie.rb https://gist.githubusercontent.com/jkbrzt/e59a0cde6ae6f59f2182/raw/httpie.rb
@duginivijay the Python 3 based formula is available directly from Homebrew (brew install httpie
).
Ignore my post mate. I had multiple version of pythons in my machine due to which it wasn't able to pick the right one and was throwing error. Posting this thinking it may be helpful for someone.
I've having some issues trying to use HTTPie with https://matiaskorhonen.fi, which is confusing since the site work fine in every browser I've tried and with curl. HTTPie on the other hand gives a
Connection reset by peer
error:Using
--verify=no
doesn't help either. The server uses SNI TLS, might that be the issue?