我正在使用libcurl将xml数据发送到服务器,我正在使用readfunction方法在投递邮件头后发布data.But,content-length标头正在更改为-1。我从libcurl获得错误消息,如:- HTTP error before end of send, stop sending
Content-Type: text/xml
Content-Length: 249
<?xml version="1.0" encoding="UTF-8"?><STBSCANMANUALINFO><FREQUENCY>305944</FREQUENCY> <SYMBOLRATE>6899</SYMBOLRATE><MODULATION> MOD_64QAM</MODULATION><STATUS> LOCKED</STATUS><QUALITY>100</QUALITY><BER>0</BER><RFLEVEL>40</RFLEVEL></STBSCANMANUALINFO>
Connection:keep-alive
Content-Length: -1
Expect: 100-continue我没搞错什么地方。
发布于 2014-01-10 09:17:57
使用CURLOPT_POSTFIELDSIZE显式设置POST大小,如本官方样本代码所示
/* Set the expected POST size. If you want to POST large amounts of data,
consider CURLOPT_POSTFIELDSIZE_LARGE */
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, pooh.sizeleft);https://stackoverflow.com/questions/21016401
复制相似问题