title: Parse HTTP headers in C++
body: <p>I am using curl to communicate with a server.</p>
  
  <p>When I make a request for data I receive the HTTP headers followed by jpeg data separated by a boundary like so:</p>
  
  <p><img src="https://i.stack.imgur.com/L0BgE.png" alt="enter image description here"></p>
  
  <p>I need to parse out</p>
  
  <ol>
  <li>The boundary string</li>
  <li>The Content-Length.</li>
  </ol>
  
  <p>I have copied the incoming data to a a char array like so:</p>
  
  <pre><code>static size_t OnReceiveData ( void * pvData, size_t tSize, size_t tCount, void * pvUser )
  {
      printf("%*.*s", tSize * tCount, tSize * tCount, pvData);
  
      char* _data;
      if(pvData != nullptr &amp;&amp; 0 != tCount)
      {
          _data = new char[tCount];
         memcpy(_data, pvData, tCount);
      }
  
      return ( tCount );
  }
  </code></pre>
  
  <p>How can I best do this in C++??  How do I actually inspect and parse the _data array for the information that I want??  Are the any boost libraries that I can use for example??</p>