2014-10-02 40 views
-1

Libcurl將Accept標記爲默認值爲Accept: */*的http標頭。如何從libcurl中的http標頭中刪除接受

我想避免libcurl將Accept放入http頭中。我該怎麼做?使用自定義頁眉

struct curl_slist *chunk = NULL; 
chunk = curl_slist_append(chunk, "Accept:"); 

res = curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); 
res = curl_easy_perform(curl); 

一個稍微完整的例子在C:

+1

請參閱http://stackoverflow.com/questions/7638661/how-to-stop-curl-php-from-sending-accept-header(不是C,但仍然) – deviantfan 2014-10-02 13:58:50

+0

正如@deviantfan所說,完全相同的方式適用於C中的libcurl。 – 2014-10-03 06:07:19

+0

@DanielStenberg這個例子是在PHP中,我無法在C. coul中找到這個代碼的等價物d您請在C中提供相當於此代碼的答案 – MOHAMED 2014-10-07 16:18:20

回答