场景
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>
Analysis
indicates that packets sent does not carry the Content-Length, but the message sent by the entity actually is 0 bytes
The reason
libcurl library only call curl_easy_setopt (pCurlHandle, CURLOPT_POSTFIELDS, "" ) ;, will go automatically generated Content-Length
Solution to manually specify a Content-Length pCurlHeadList = curl_slist_append (pCurlHeadList , "Content-length: 0");
second solution curl_easy_setopt (pCurlHandle, CURLOPT_POSTFIELDS, "" );