Mercurial > minori
comparison src/core/http.cc @ 389:1e5d922fe82b default tip
kitsu: implement UpdateAnimeEntry
yay... i guess
| author | Paper <paper@tflc.us> |
|---|---|
| date | Thu, 06 Nov 2025 12:21:35 -0500 |
| parents | aa38b904de4f |
| children |
comparison
equal
deleted
inserted
replaced
| 388:83aa0ddd1a46 | 389:1e5d922fe82b |
|---|---|
| 80 if (curl) { | 80 if (curl) { |
| 81 for (const std::string &h : headers) | 81 for (const std::string &h : headers) |
| 82 list = curl_slist_append(list, h.c_str()); | 82 list = curl_slist_append(list, h.c_str()); |
| 83 | 83 |
| 84 curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); | 84 curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); |
| 85 if (type == Type::Post) | 85 if (type == Type::Post || type == Type::Patch) |
| 86 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str()); | 86 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str()); |
| 87 if (type == Type::Patch) | |
| 88 curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PATCH"); | |
| 87 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); | 89 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); |
| 88 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &userdata); | 90 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &userdata); |
| 89 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &WriteCallback); | 91 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &WriteCallback); |
| 90 /* Use system certs... useful on Windows. */ | 92 /* Use system certs... useful on Windows. */ |
| 91 curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA); | 93 curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA); |
| 163 | 165 |
| 164 CURL *curl = curl_easy_init(); | 166 CURL *curl = curl_easy_init(); |
| 165 if (curl) { | 167 if (curl) { |
| 166 curl_easy_setopt(curl, CURLOPT_URL, url_.c_str()); | 168 curl_easy_setopt(curl, CURLOPT_URL, url_.c_str()); |
| 167 | 169 |
| 168 if (type_ == Type::Post) | 170 if (type_ == Type::Post || type_ == Type::Patch) |
| 169 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data_.c_str()); | 171 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data_.c_str()); |
| 170 | 172 |
| 171 for (const std::string &h : headers_) | 173 for (const std::string &h : headers_) |
| 172 list = curl_slist_append(list, h.c_str()); | 174 list = curl_slist_append(list, h.c_str()); |
| 173 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); | 175 curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list); |
