使用libcurl列出服务器上的目录。服务器仅提供文件时间日期,而不是详细时间

时间:2013-12-23 03:24:11

标签: c libcurl

我尝试使用libcurl通过downloadBuffer方法列出服务器上的目录

resetOptions();

if (headerBuffer)
{
    curl_easy_setopt(m_curl, CURLOPT_HEADERFUNCTION, write_response);
    curl_easy_setopt(m_curl, CURLOPT_WRITEHEADER, headerBuffer);
}

curl_easy_setopt(m_curl, CURLOPT_URL, SV_PathA (m_header.c_str()).add(remotefile).get());
curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, write_response);
curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, &buffer);

curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1);


/* Now run off and do what you've been told! */
int code = curl_easy_perform(m_curl);

if (postquotelist)
    curl_slist_free_all(postquotelist); 
if(CURLE_OK != code)
{
    setError(code,m_errorBuffer);
    return false;
}

  return true;

除了一个问题外,它运作良好。 服务器仅提供文件时间日期,而不是详细时间。 例如,这是一条线 drwxr-xr-x 3 compurxc compurxc 4096 Nov23 2012。 而且有很多这样的界限。

我可以获取文件名,filesize但lastmod时间只是一个日期。 如何使用libcurl切换服务器以提供详细的lastmod时间?

非常感谢,

祝你好运, Kelvin Gan

0 个答案:

没有答案