How to get the length of a file without downloading the file in a cURL binary get request

后端 未结 3 713
夕颜
夕颜 2021-01-18 01:07

I want to create a cURL request in some C++ code which will get me the length of a file in a server without downloading the file. For that, I use some cURL options to tell I

3条回答
  •  滥情空心
    2021-01-18 01:52

    need call perform()

    curl_easy_setopt(_curl_handle, CURLOPT_HEADER, 1); curl_easy_setopt(_curl_handle, CURLOPT_NOBODY, 1);

    curl_easy_perform(_curl_handle);

    curl_easy_getinfo(_curl_handle, CURLINFO_CONTENT_LENGTH_UPLOAD, &dResult);

提交回复
热议问题