void Session::Impl::SetHeader(const Header& header) { auto curl = curl_->handle; if (curl) { struct curl_slist* chunk = NULL; for (auto item = header.cbegin(); item != header.cend(); ++item) { auto header_string = std::string{item->first}; if (item->second.empty()) { header_string += ";"; } else { header_string += ": " + item->second; } chunk = curl_slist_append(chunk, header_string.data()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk); curl_->chunk = chunk; } } }