title: How to stop Curl from caching data
body: <p>I have a HTTP streaming video server that I access using a url like so:</p>
  
  <pre><code>https://192.168.50.23:8011/livevideo/8
  </code></pre>
  
  <p>If I paste this url in to my web browser address bar I can see live video but after a few minutes the video stops streaming.  If I kill the browser and repeat the process I can get video streaming for another few minutes before it stops again.</p>
  
  <p>I figured that it must be something to do with the web browser caching the MJPEG frames and running out of memory so as an experiment I mocked up a simple HTML page like so:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;img src="https://192.168.50.23:8011/livevideo/8" width="500" height="500"&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And the result is that the vieo streams constantly and never stops.  So I guess the  tag is dealing with disposing of the MJPEG frames and not causing a crash like before.</p>
  
  <p>I used FireFox to analyse the HTTP requests and responses for both scenarios above to see if there is anything different and here is the results:</p>
  
  <p><strong>URL pasted into webbrowser address bar:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/UK4nt.png" alt="URL pasted into webbrowser address bar"></p>
  
  <p><strong>URL embedded into web page:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/tNfQV.png" alt="enter image description here"></p>
  
  <p>The only differences seems to be the <strong>Accept: Parameters</strong>.</p>
  
  <p>Now to move onto my real problem.  I am using the same url in my C++ curl program and I am seeing the exact same behaviour where I receive video data for a few mins and then all of a sudden the curl callbacks stop.</p>
  
  <p>I have used the following headers in my curl program:</p>
  
  <pre><code>CURL *pEasy = curl_easy_init ();
  curl_easy_setopt ( pEasy, CURLOPT_USERNAME, user.c_str() );
  curl_easy_setopt ( pEasy, CURLOPT_PASSWORD, pass.c_str() );
  curl_easy_setopt ( pEasy, CURLOPT_URL, urlToConnectTo.c_str() );
  
  //Set authentication
  curl_easy_setopt ( pEasy, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
  curl_easy_setopt ( pEasy, CURLOPT_SSL_VERIFYPEER, false );
  curl_easy_setopt ( pEasy, CURLOPT_SSL_VERIFYHOST, false );
  
  curl_easy_setopt ( pEasy, CURLOPT_HEADER, TRUE );
  curl_easy_setopt ( pEasy, CURLOPT_NOBODY, FALSE );
  
  curl_easy_setopt ( pEasy, CURLOPT_WRITEFUNCTION, OnReceiveHttpBodyResponse );
  curl_easy_setopt ( pEasy, CURLOPT_WRITEDATA, pEasy );
  
  struct curl_slist *headers=NULL; 
  curl_slist_append( headers, "User-Agent: MyCurlDll");
  curl_slist_append( headers, "Content-Type: text/xml");
  curl_slist_append( headers, "Connection: Keep-Alive");
  curl_slist_append( headers, "Accept: image/png, text/xml, text/html, application/xml");
  curl_slist_append( headers, "Cache-Control: max-age=0");
  curl_easy_setopt(pEasy, CURLOPT_HTTPHEADER, headers);
  
  curl_multi_add_handle(m_curlMulti, pEasy);
  
  //Process this curl handle in another function
  </code></pre>
  
  <p>What can I do to stop this behaviour in CURL?  I assume it must be caching is the same way as the browser was doing it. </p>