bool HttpContentNegociation::Apply(const HttpHeaders& headers)
 {
   HttpHeaders::const_iterator accept = headers.find("accept");
   if (accept != headers.end())
   {
     return Apply(accept->second);
   }
   else
   {
     return Apply("*/*");
   }
 }
Exemple #2
0
  void setHeaders(const HttpHeaders& headers)
  {
    if (m_headerlist) {
      curl_slist_free_all(m_headerlist);
      m_headerlist = NULL;
    }

    std::string tmp;
    for (HttpHeaders::const_iterator it=headers.begin(), end=headers.end(); it!=end; ++it) {
      tmp = it->first;
      tmp += ": ";
      tmp += it->second;

      m_headerlist = curl_slist_append(m_headerlist, tmp.c_str());
    }

    curl_easy_setopt(m_curl, CURLOPT_HTTPHEADER, m_headerlist);
  }