Hi All,
I've now tested libcurl.lib itself, just to check the problem is not in
there. conclusion: it isn't, the problem is somehow in curlpp.
I've used the following c-code:
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL,
"http://www.swi-prolog.org/download/stable/bin/w64pl641.exe");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 1);
curl_easy_setopt(curl, CURLOPT_NOBODY, 1);
res = curl_easy_perform(curl);
double result;
curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &result);
printf ( "%f\n", result );
curl_easy_cleanup(curl);
}
return 0;
}
The above code gives the expected result and prints out the correct size of
the file in question.
Which, as far as I can see is equivalent to this version in C++ with curlpp:
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
#include <curlpp/Infos.hpp>
int main ( ) {
curlpp::Cleanup cleaner;
curlpp::Easy request;
request.setOpt ( curlpp::options::Url (
"http://www.swi-prolog.org/download/stable/bin/w64pl641.exe" ) );
request.setOpt ( curlpp::options::FollowLocation ( true ) );
request.setOpt ( curlpp::options::Header ( true ) );
request.setOpt ( curlpp::options::NoBody ( true ) );
request.perform ( );
std::cout << curlpp::infos::ContentLengthDownload::get ( request );
}
This program though, does get the header (I've tested that), but the length
printed is gibberish (4.71219e+018).
Any thoughts, please?
Cheers
degski
--
You received this message because you are subscribed to the Google Groups
"curlpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/curlpp.
For more options, visit https://groups.google.com/groups/opt_out.