-
-
[求助]libcurl如何更改header信息
-
发表于:
2015-11-9 21:28
4511
-
想要发出去的POST信息如下:
POST /p/SendFile.aspx?ImageType=bmp HTTP/1.1
User-Agent: client
Host: 11.22.16.45
Content-Length: 7742
Cache-Control: no-cache
后面紧跟着就是bmp图片数据
问题代码如下:
CURL *curl = curl_easy_init();
CString sPage.Format("
b25K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8U0p5I4i4K6u0W2x3U0u0Q4x3X3f1I4y4W2)9J5k6e0b7#2i4K6u0r3M7q4)9J5c8W2y4W2L8X3c8r3K9h3I4W2i4K6u0W2j5i4y4H3P5q4)9K6c8V1W2E0j5h3N6W2g2s2W2H3k6g2)9K6c8r3u0E0M7l9`.`.");
string data = ...; //bmp数据
curl_easy_setopt(curl, CURLOPT_URL, sPage);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.data());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, data.size());
curl_easy_setopt(curl, CURLOPT_USERAGENT, "client");
CURLcode res = curl_easy_perform(curl);
这个代码会发出去POST信息,但头和要求的不一致,多了下面三个项:
accept, content-type,expect:100-continue;
怎么去掉它,是不是上述调用方法有问题?
还望指教
[培训]科锐逆向工程师培训第53期2025年7月8日开班!