简体   繁体   中英

trusted certificate curl vs httpie

trying to understand how to work around with self signed certificates. I am using vagrant ubuntu xenial box .After importing the ROOT certificate using method described in unix.stackexchange.com . To my surprised curl worked but httpie doesn't.

dpkg-reconfigure ca证书

 curl  -XPOST -H "Content-Type: application/json" -d '{"name":"Joseph","sname":"adfadf"}' https://x.x.x.x/test.php

echo '{"name":"Joseph","sname":"adfadf"}' | http POST  https://x.x.x.x/test.php

http: error: SSLError: HTTPSConnectionPool(host='x.x.x.x', port=443): Max retries exceeded with url: /test.php (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)'),)) while doing POST request to URL: https://x.x.x.x/test.php

However when I use the --verify option of httpie it worked. But that's a bit against the method of trusting the certificate on the server that making the call to the API.

Is there anything I am not doing well?

After much googlefu, it turns out it's a bug under the httpie github page . It started working when I swapped the pip installation with an apt-get installation of httpie

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM