curlpp::infos::XX:get doesn' t return same result as InfoGetter
Hello,
first i would like to thank you for writing this library as working with libcurl C interface is a hell.
However i have found one cosmetic issue, that curlpp::infos::XX::get gives different output than InfoGetter. InfoGetter always gives correct results.
Sample code
double download_time, download_speed, download_time2, download_speed2;
curlpp::InfoGetter::get(request,CURLINFO_TOTAL_TIME, download_time);
curlpp::InfoGetter::get(request,CURLINFO_SPEED_DOWNLOAD, download_speed);
curlpp::infos::TotalTime::get(request, download_time2);
curlpp::infos::SpeedDownload::get(request, download_time2);
Strange thing for me was that curlpp::infos::ResponseCode::get(request) was working as it should and i have found the problem. This function defined in Info.cpp
template<>
void
InfoTypeConverter<double>::get(const curlpp::Easy & handle,
CURLINFO info,
double & value)
{
curl_off_t tmp;
InfoGetter::get(handle, info, tmp);
value = (double)tmp;
}
for some strange reason wants to put double inside a long. What actually this does is, it inserts time which is double into long removing the floating point. After that the conversion to value just randomly inserts floating point back. I haven' t tested it as i end up with using InfoGetter directly, but this should fix the problem.
template<>
void
InfoTypeConverter<double>::get(const curlpp::Easy & handle,
CURLINFO info,
double & value)
{
InfoGetter::get(handle, info, value);
}
Thanks for the report, I'll have a look.
The problem is here: https://github.com/jpbarrette/curlpp/issues/89