benibela / xidel

Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
http://www.videlibri.de/xidel.html
GNU General Public License v3.0
681 stars 42 forks source link

[Bug] Xidel can't find certificate-file when the working dir is NOT the dir with the certificate-file #63

Closed Reino17 closed 3 years ago

Reino17 commented 3 years ago
D:\xidel>xidel.exe --version
Xidel 0.9.9
(20201225.7740.54d5613fce4e)

This is the OpenSSL Windows binary.

Calling xidel.exe directly from D:\xidel (with cacert.pem there too) works:

D:\xidel>xidel -s https://github.com/benibela/xidel -e "//title"
GitHub - benibela/xidel: Command line tool to [...]

Calling xidel.exe from another dir (with full path) does not work:

D:\>D:\xidel\xidel.exe -s https://github.com/benibela/xidel -e "//title"
Error:
Internet Error: -3 Failed to load CA files from "" and "".
when talking to: https://github.com/benibela/xidel

The same goes for the %PATH%-variable:

SET "PATH=%PATH%;D:\xidel"

D:\>xidel.exe -s https://github.com/benibela/xidel -e "//title"
Error:
Internet Error: -3 Failed to load CA files from "" and "".
when talking to: https://github.com/benibela/xidel

For the OpenSSL dlls xidel is looking in %PATH% and the dir it's executed from.
How about it would do the same for 'cacert.pem' / 'ca-bundle.crt' ? Or would that be a security risk?


I guess "" and "" is not what you intended as an error message, or is it?

benibela commented 3 years ago

Calling xidel.exe from another dir (with full path) does not work:

I have changed that: https://github.com/benibela/internettools/commit/872a9b120c49d0246b3bea42b05dc3b59996aa31

I guess "" and "" is not what you intended as an error message, or is it?

It is very helpful to see whether it could not find the file/dir, or found them but could not load them

Reino17 commented 3 years ago

Fix confirmed. Thanks.