Everything the four bindings used to spell out one at a time. The only conditional options are the ones a transfer genuinely varies: verb, headers, body source, redirect following, progress callback.
| 127 | // conditional options are the ones a transfer genuinely varies: verb, |
| 128 | // headers, body source, redirect following, progress callback. |
| 129 | void applyCommonOptions(CURL* curl, const Http::Request& req, std::string* data, std::string* rhdr) |
| 130 | { |
| 131 | curl_easy_setopt(curl, CURLOPT_URL, req.url ? req.url : ""); |
| 132 | curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeToString); |
| 133 | curl_easy_setopt(curl, CURLOPT_WRITEDATA, data); |
| 134 | if (rhdr) { |
| 135 | curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, writeToString); |
| 136 | curl_easy_setopt(curl, CURLOPT_HEADERDATA, rhdr); |
| 137 | } |
| 138 | curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); |
| 139 | curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, req.followRedirects ? 1L : 0L); |
| 140 | curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); |
| 141 | curl_easy_setopt(curl, CURLOPT_USERAGENT, "Checkpoint-curl"); |
| 142 | curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 300L); |
| 143 | curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | namespace Http { |