title: CURLFORM_STREAM pointer not being used by CURLOPT_READFUNCTION
body: <p>I am trying to send a multipart MIME message with custom streaming (multiple binary files). To this end, I cannot get my <code>CURLOPT_READFUNCTION</code> callback to use a pointer set by <code>CURLFORM_STREAM</code>. </p>
  
  <p>So far as I can tell, <a href="http://curl.haxx.se/libcurl/c/curl_formadd.html#CURLFORMSTREAM" rel="nofollow">the <code>CURLFORM_STREAM</code> documentation</a> automatically calls the <code>CURLOPT_READFUNCTION</code> pointer when it begins to stream data. This is not happening for me.</p>
  
  <p>Here's my current code sample (I've been trying different configurations with no success). <code>CURLCODECHECK</code> and <code>CURLFORMCHECK</code> are macros that throw exceptions on an error. <code>streams</code> is a vector of my own <code>StreamData</code> structs.</p>
  
  <pre><code>        CURLCODECHECK(curl_easy_setopt(m_Curl, CURLOPT_HTTPPOST, 1L));
          CURLCODECHECK(curl_easy_setopt(m_Curl, CURLOPT_READFUNCTION, ::StreamReadFunction));
  
          for (auto iter = streams.begin(); iter != streams.end(); ++iter)
          {
              std::string const &amp; name = iter-&gt;first;
              auto streamData = iter-&gt;second;
  
              CURLFORMCHECK(curl_formadd(&amp;m_Post, &amp;last,
                  CURLFORM_COPYNAME, name.c_str(),
                  CURLFORM_FILENAME, streamData-&gt;fileName.c_str(),
                  CURLFORM_CONTENTTYPE, streamData-&gt;mimeType.c_str(),
                  CURLFORM_STREAM, (void *) streamData.get(),
                  CURLFORM_CONTENTSLENGTH, streamData-&gt;size,
                  CURLFORM_END));
          }
  </code></pre>
  
  <p>My <code>::StreamReadFunction</code> does get called, but unless I call <code>curl_easy_setopt()</code> with <code>CURLOPT_READDATA</code> set, it gets passed a null pointer for the fourth (void * userdata) argument.</p>