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

"SSLError: hostname <x> doesn't match <y>" - but Curl/Chrome don't report SSL issues? #262

Closed
victorhooi opened this issue Sep 26, 2014 · 4 comments

Comments

@victorhooi
Copy link

I'm attempting to use httpie with the JIRA REST API.

The command fails with an "SSLError: hostname doesn't match" style message:

bash-3.2$ http https://jira.mongodb.org/rest/api/2/search?jql=assignee=bob

http: error: SSLError: hostname 'jira.mongodb.org' doesn't match either of '*.mongodb.com', 'mongodb.com'

My understanding is that requests should normally throw up that error if the SSL certificate isn't valid. The message seems to imply that the cert is for *.mongodb.com, which jira.mongodb.org wouldn't fall under.

However, the same command works fine via CuRL, with no SSL warnings:

bash-3.2$ curl -v  https://jira.mongodb.org/rest/api/2/search?jql=assignee=free
* Adding handle: conn: 0x7fbe2b003a00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fbe2b003a00) send_pipe: 1, recv_pipe: 0
* About to connect() to jira.mongodb.org port 443 (#0)
*   Trying 54.221.213.229...
* Connected to jira.mongodb.org (54.221.213.229) port 443 (#0)
* TLS 1.1 connection using TLS_RSA_WITH_AES_256_CBC_SHA
* Server certificate: jira.mongodb.org
* Server certificate: Go Daddy Secure Certification Authority
* Server certificate: Go Daddy Class 2 Certification Authority
> GET /rest/api/2/search?jql=assignee=free HTTP/1.1
> User-Agent: curl/7.30.0
> Host: jira.mongodb.org
> Accept: */*
>
< HTTP/1.1 200 OK
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< Vary: Accept-Encoding
< Cache-Control: no-cache, no-store, no-transform
< Content-Type: application/json;charset=UTF-8
< Date: Fri, 26 Sep 2014 02:14:22 GMT
< X-AREQUESTID: 134x54195573x2
< Transfer-Encoding: chunked
< X-AUSERNAME: anonymous
< Set-Cookie: atlassian.xsrf.token=ASGJ-NC06-6R0X-EKH7|4d65065ad638afb4fe7edb9b04e81379cc315e06|lout; Path=/
<
* Connection #0 to host jira.mongodb.org left intact
{"startAt":0,"maxResults":50,"total":0,"issues":[]}

Furthermore, it also loads up fine in my browser (Chrome), and no SSL warnings are give.

screen shot 2014-09-26 at 12 12 05 pm

Any thoughts on what might be going on please?

@sigmavirus24
Copy link

sigmavirus24 commented Sep 26, 2014

This has to do with SNI. You need to install extra dependencies which you'll get if you do 'pip install requests[security]'

Sent from my Android device with K-9 Mail. Please excuse my brevity.

mattrobenolt added a commit to mattrobenolt/httpie that referenced this issue Dec 22, 2014
mattrobenolt added a commit to mattrobenolt/httpie that referenced this issue Dec 22, 2014
@Craiting
Copy link

Having the same problem but the only way I can get a request to work is if I set verify to False. I tried upgrading requests and installing requests[security] and even setting verify to the cert file.

@NuSkooler
Copy link

I was having this problem as well. I needed to upgrade requests[security] and httpie:

pip install --upgrade requests[security]
pip install --upgrade httpie

@jkbrzt
Copy link
Member

jkbrzt commented May 23, 2020

These errors should be gone in newer HTTPie versions which rely on Python 3.6+.

@jkbrzt jkbrzt closed this as completed May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants