简体   繁体   中英

c use libcurl curl_easy_perform post, spaces and dot replaced by underscore

c use libcurl curl_easy_perform post, spaces and dot replaced by underscore

The code is like the example below.

On the other side the received data is wrong:

Expect: <Text>data to send...</Text>
Actually: <Text>data_to_send___</Text>

CURL *curl = curl_easy_init();
if(curl) {
    const char *data = "<Text>data to send...</Text>";
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
}

Does anybody know the reason?

That's an incorrect conclusion so the question ends up rather useless.

libcurl will send the data exactly as you provide it with CURLOPT_POSTFIELDS . If the data end up looking different in some presentation layer of yours, then it was either changed or displayed like that by some other layer/software component.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM