0
votes

I have installed libcurl (curl-7.60.0) from source as a static library in Windows 10 and Visual studio 2015. In curl/curl.h I added these #defines: BUILDING_LIBCURL, CURL_STATICLIB, USE_SCHANNEL, and USE_WINDOWS_SSPI. From C++ I have no problem to access and save to file from http:// with a simple write callback function (return fwrite(ptr, size, nmemb, (FILE *)stream)).

When I try downloading from https://[host][file path] with the same callback function I have nothing downloaded. Curl_version_info says https is supported (with no multiple backends), with TLS library name = WinSSL. Schannel reports a SSL/TLS connection with the host. Curl reports a "GET [file path] HTTP/1.1" and "Accept /".

Then schannel reports reading and decrypting some data, "HTTP/1.1 302 FOUND" and the correct Location. Curl_easy_perform reports no error, but Content-length is 0, no bytes are written and I can see that the write callback function has never been called.

Downloading the same file with a web browser is no problem.

It seems I have not managed to invoke the write callback function for the https body. I can find no curl_easy_setopt option to solve this and suspect some #define is missing for the build of the library.

Can anyone understand and assist, please?

1

1 Answers

0
votes

The write callback works the same independently of what protocol that's used.

However, a HTTP response 302 with no content-length sounds like nothing to send to the callback so that would be perfectly normal!

You probably want to tell libcurl to follow redirects?