4

When I use Octave 3.8.1 installed in Cygwin, I can successfully download https pages like this:

urlwrite('https://www.google.com', 'downloaded.html')

However, when I use Octave 3.6.4 installed in Windows 7 SP1 Pro 64bit, urlwrite() doesn't work:

octave-3.6.4.exe:18> urlwrite('https://www.google.com', 'downloaded.html')
error: urlwrite: curl: Problem with the SSL CA cert (path? access rights?)

urlread() has the same problem. Is there a good way to avoid this error?

Update:

Following Andy's advice, I tried to fix a curl-related problem. At the moment, curl.exe can work for https, but libcurl (I think embedded in octave) doesn't work for https. let me explain what I did.

I downloaded curl.exe from here. At first, it doesn't work for https like this:

C:\somewhere\curl-7.33.0-win64-nossl>curl https://www.google.com/
curl: (1) Protocol https not supported or disabled in libcurl

After I downloaded "cacert.pem" from here, renamed it to "curl-ca-bundle.crt", and put it in C:\windows\system32, curl.exe can extract pages from https sites.

However, when I use urlwrite() in Octave, it's still not working. I guess that octave internally calls libcurl API, but I don't know how to force libcurl to find CA certs.

user64953
  • 723
  • 1
  • 6
  • 10
  • Why have you installed 3.6.4 and which build? MinGW. MS Visualc, Cygwin? And for Windows 7 64bit I would suggest an inofficial MXE build from http://mxeoctave.osuv.de/. – Andy Oct 08 '14 at 12:14
  • I clicked a link "Octave 3.6.4 for Windows Microsoft Visual Studio" in http://sourceforge.net/projects/octave/files/Octave%20Windows%20binaries/. I think 3.6.4 is the latest official version for Windows. – user64953 Oct 08 '14 at 14:02
  • I tried inofficial MXE build 3.8.2-3 portable, but I got the same result. – user64953 Oct 08 '14 at 15:35
  • You are using https, have you installed the CA certs? See here http://curl.haxx.se/docs/caextract.html and here is also a thread howto do this: https://superuser.com/questions/442793/why-cant-curl-properly-verify-a-certificate-on-windows – Andy Oct 08 '14 at 16:44
  • Unfortunately it's still not working. I edited the question to describe what I did. – user64953 Oct 09 '14 at 15:08
  • TLS certificate issue looks still persists as in http://octave.1599824.n4.nabble.com/pkg-install-from-forge-in-windows-td4680633.html. – mon Jan 16 '17 at 23:25

2 Answers2

3

I have the same probem using urlread() in Octave 4.0.0 for Windows. I tried a few things but none worked. I did manage to get the curl command line tool to work tho. So in the end the easiest thing for me was to write my own urlread() which called curl using Octave's system() function:

function retval=my_urlread(url) command=['curl --silent ','"',url,'"']; [output,text]=system(command); retval=text; endfunction

john
  • 31
  • 3
1

I analyzed source code of CURL and can say: you can't solve this without source editing. CURL has two entrance points: if you run curl.exe it setup libcurl with environment variables and files from working dir, and if you're using libcurl through curl_easy_perform from libcurl.dll (like Octave), you must provide all settings manually. So you can setup your environment such way, that curl.exe from Octave's binary dir will load data without additional parameters (curl.exe https://google.com), but Octave's urlread will not work.