title: Compute Content-MD5 from libcurl for HTTP POST
body: <p>I am using libcurl to build up an HTTP POST, using struct curl_httppost with curl_formadd, etc.</p>
  
  <p>I need to be able to compute an MD5 hash value for the entire contents as they will be posted, including the boundary markers, etc.  That MD5 then needs to be uploaded as the HTTP header "Content-MD5".</p>
  
  <p>Is there a way to get the raw post content from the curl API so that I can compute an MD5 on it before it is posted?  Or, is there already a mechanism within curl to simply compute the MD5 and set the header internally?</p>
  
  <pre><code>struct curl_httppost* list = NULL;
  struct curl_httppost* last = NULL;
  
  curl_formadd (&amp;list, &amp;last,
      CURLFORM_COPYNAME, pFieldName,
      CURLFORM_BUFFER, pFieldFilename,
      CURLFORM_BUFFERPTR, pFileContents,
      CURLFORM_BUFFERLENGTH, lenFileContents,
      CURLFORM_END);
  
  curl_easy_setopt(session, CURLOPT_URL, url); 
  curl_easy_setopt(session, CURLOPT_HTTPPOST, list);
  </code></pre>
  
  <p>Thanks.</p>