~ories/+junk/net-cpp-curl-multi_http_header_support

« back to all changes in this revision

Viewing changes to src/core/net/http/impl/curl/easy.cpp

  • Committer: Olli Ries
  • Date: 2014-04-24 04:28:50 UTC
  • Revision ID: olli@olli-ries.net-20140424042850-xo6vrd5nkme2st86
implementingĀ CURLOPT_HTTPHEADER

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
    return result;
246
246
}
247
247
 
 
248
easy::Handle& easy::Handle::header(const std::set<std::string>& header)
 
249
{
 
250
    if (!d) throw easy::Handle::HandleHasBeenAbandoned{};
 
251
 
 
252
    std::set<std::string>::const_iterator itr;
 
253
    struct curl_slist *customheader = NULL;
 
254
 
 
255
    for (itr = header.begin(); itr != header.end(); ++itr){
 
256
      customheader = curl_slist_append(customheader, itr->c_str()); 
 
257
    }
 
258
 
 
259
    set_option(Option::http_header, customheader);
 
260
    return *this;
 
261
}
 
262
 
248
263
easy::Handle& easy::Handle::url(const char* url)
249
264
{
250
265
    if (!d) throw easy::Handle::HandleHasBeenAbandoned{};