2013-03-24 88 views
0

連接到服務器併發送特定的QUOTE命令時,libcurl(7.29.0)似乎在請求目錄列表,即使我不想要這樣做。 這是我回來的迴應,它表示發送MDTM命令後,libcurl發送一個我不想要的LIST命令。我如何防止它發送LIST?的捲曲會話代碼阻止libcurl發送FTP LIST命令

* Request has same path as previous transfer 
> MDTM fileName 
< 213 20130324223404 
> EPSV 
* Connect data stream passively 
< 229 Entering Extended Passive Mode (|||x|) 
* Trying ip... 
* Connecting to ip (ip) port x 
> LIST 
< 150 Here comes the directory listing. 

部分(我重用這裏的捲曲處理以前改變了遠程目錄到文件名是和得到一個目錄用於其他目的上市):

headers = NULL; 
    headers = curl_slist_append(headers, "MDTM fileName"); 
    curl_easy_setopt(curlSession, CURLOPT_QUOTE, headers);  
    curl_easy_setopt(curlSession, CURLOPT_WRITEHEADER, &fileModResponse); 
    res = curl_easy_perform(curlSession); 

回答

1

我下載了libcurl來源並找到答案。指定CURLOPT_NOBODY選項會阻止它發送FTP LIST命令。

curl_easy_setopt(curlSession, CURLOPT_NOBODY, 1);