question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

problem in httpie/coreapi ssl library?

See original GitHub issue

By some testing with httpie I have discovered that httpie and coreapi fail to accept an ssl certificate if it does not come first in the ‘pem’ file:

$ http -a root:password123 GET https://www.site2.example.com/users/
hostname 'www.site2.example.com' doesn't match either of 'site1.example.com', 'www.site1.example.com'

The browsers and curl work OK as expected.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ygramoelcommented, Jan 18, 2017

I am experiencing a very similar problem with newer versions of http (0.8.0) and python (3.4.3)

Below is the output of http, wget and curl on the same url (cairon.net), as well as the output of http --version and python --version. Feel free to try it with any other http versions.

johan@ygramoel:~\> http https://cairon.net

http: error: SSLError: hostname 'cairon.net' doesn't match 'agenda.sikando.be'
johan@ygramoel:~\> curl https://cairon.net
<html>
<header>
<title>This is title</title>
<link rel="stylesheet" type="text/css" href="site.css">
<link rel='stylesheet' href='fullcalendar.css' />
<script src='lib/jquery.min.js'></script>
<script src='lib/moment.min.js'></script>
<script src='fullcalendar.js'></script>
<script src='locale/nl-be.js'></script>
<script src='site.js'/></script>
</header>

<body>
<p>Hello world</p>
<div id='calendar'></div>
</body>
</html>
johan@ygramoel:~\> wget https://cairon.net
--2017-01-18 10:33:26--  https://cairon.net/
Resolving cairon.net (cairon.net)... 178.238.235.158
Connecting to cairon.net (cairon.net)|178.238.235.158|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 427 [text/html]
Saving to: 'index.html'

100%[======================================>] 427         --.-K/s   in 0s      

2017-01-18 10:33:27 (229 MB/s) - 'index.html' saved [427/427]
johan@ygramoel:~\> http --version
0.8.0

johan@ygramoel:~\> python --version
Python 3.4.3
</body>
</html>
johan@ygramoel:~\> wget https://cairon.net
johan@ygramoel:~\> http --version
0.8.0

johan@ygramoel:~\> python --version
Python 3.4.3
1reaction
kresimir71commented, Nov 25, 2016

I will shortly reopen it, but just remove it as you please because I do not use these utilities actively. Because coreapi reacts with the same error and curl works correctly, we can of course conclude that the problem is in some python ssl library…


root@buf1512:~# /usr/local/bin/http --version
0.9.6
root@buf1512:~# /usr/local/bin/http --debug -a root:pass1234 GET https://www.site2.example.com/users/
HTTPie 0.9.6
Requests 2.12.1
Pygments 2.1.3
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2]
/usr/bin/python
Linux 2.6.32-042stab104.1

<Environment {
    "colors": 8,
    "config": {
        "__meta__": {
            "about": "u'HTTPie configuration file'",
            "help": "u'https://github.com/jkbrzt/httpie#config'",
            "httpie": "u'0.9.6'"
        },
        "default_options": "[]"
    },
    "config_dir": "/root/.httpie",
    "is_windows": false,
    "stderr": "<open file '<stderr>', mode 'w' at 0x7fe41dab8270>",
    "stderr_isatty": true,
    "stdin": "<open file '<stdin>', mode 'r' at 0x7fe41dab8150>",
    "stdin_encoding": "ANSI_X3.4-1968",
    "stdin_isatty": true,
    "stdout": "<open file '<stdout>', mode 'w' at 0x7fe41dab81e0>",
    "stdout_encoding": "ANSI_X3.4-1968",
    "stdout_isatty": true
}>

>>> requests.request(**{
    "allow_redirects": false,
    "auth": "<httpie.plugins.builtin.HTTPBasicAuth object at 0x1ef7750>",
    "cert": "None",
    "data": {},
    "files": {},
    "headers": {
        "User-Agent": "HTTPie/0.9.6"
    },
    "method": "u'get'",
    "params": {},
    "proxies": {},
    "stream": true,
    "timeout": 30,
    "url": "u'https://www.site2.example.com/users/'",
    "verify": true
})


http: error: SSLError: hostname 'www.site2.example.com' doesn't match either of 'site1.example.com', 'www.site1.example.com' while doing GET request to URL: https://www.site2.example.com/users/
Traceback (most recent call last):
  File "/usr/local/bin/http", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/httpie/core.py", line 227, in main
    log_error=log_error,
  File "/usr/local/lib/python2.7/dist-packages/httpie/core.py", line 99, in program
    final_response = get_response(args, config_dir=env.config.directory)
  File "/usr/local/lib/python2.7/dist-packages/httpie/client.py", line 70, in get_response
    response = requests_session.request(**kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: hostname 'www.site2.example.com' doesn't match either of 'site1.example.com', 'www.site1.example.com'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Library Errors - OpenSSLWiki
The library is complex and will encounter failures on occasion. The errors often fall into one of two categories: failing to use an...
Read more >
SSL Library Error: 218570875 error:0D07207B:asn1 encoding ...
A common reason I've seen this happen is that the file generated by the certificate authority has DOS line endings. openssl on Linux...
Read more >
SSL Library Error - BUF_MEM_grow:openssl_malloc failure
Hi, Our 32-bit process acting as EAP-TLS server running on Windows Server 2012 R2 platform uses OpenSSL third-party libraries for EAP ...
Read more >
Error "Could not load SSL library" on Android with TidHTTP
It's an app for android and all my attempts fails. All i get it's the same error "Could not load SSL library". This...
Read more >
SSL Library error and idracadm7 - Dell Community
Ran into an SSL library path error when trying to run an idracadm7 command and realized that I needed to install openssl-devel in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found