Mercurial > minori
comparison src/core/http.cc @ 413:192da585a0a8 default tip
*: fix formatting
the clang-format file was broken andjust using LLVM defaults.
now it's fixed and is more in line with what I actually prefer my
code to look like -- esp. with regards to tabulators
| author | Paper <paper@tflc.us> |
|---|---|
| date | Sat, 25 Jul 2026 14:54:32 -0400 |
| parents | 9323153786dc |
| children |
comparison
equal
deleted
inserted
replaced
| 412:05aed03e0111 | 413:192da585a0a8 |
|---|---|
| 1 #include "core/http.h" | 1 #include "core/http.h" |
| 2 #include "core/session.h" | 2 #include "core/session.h" |
| 3 #include <QByteArray> | 3 #include <QByteArray> |
| 4 #include <cstring> | |
| 4 #include <curl/curl.h> | 5 #include <curl/curl.h> |
| 5 #include <iostream> | 6 #include <iostream> |
| 6 #include <string> | 7 #include <string> |
| 7 #include <vector> | 8 #include <vector> |
| 8 #include <cstring> | |
| 9 | 9 |
| 10 namespace HTTP { | 10 namespace HTTP { |
| 11 | 11 |
| 12 std::string UrlEncode(const std::string &data) | 12 std::string UrlEncode(const std::string &data) |
| 13 { | 13 { |
| 93 // uh oh | 93 // uh oh |
| 94 len = 0; | 94 len = 0; |
| 95 } | 95 } |
| 96 } else { | 96 } else { |
| 97 res.insert(res.end(), ptr, ptr + len); | 97 res.insert(res.end(), ptr, ptr + len); |
| 98 //not needed: ptr += len; | 98 // not needed: ptr += len; |
| 99 len = 0; | 99 len = 0; |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 return res; | 103 return res; |
| 116 } | 116 } |
| 117 | 117 |
| 118 return base; | 118 return base; |
| 119 } | 119 } |
| 120 | 120 |
| 121 static void SetCurlOpts(CURL *curl, const std::string &url, const std::vector<std::string> &headers, | 121 static void SetCurlOpts( |
| 122 const std::string &data, Type type) | 122 CURL *curl, const std::string &url, const std::vector<std::string> &headers, const std::string &data, Type type) |
| 123 { | 123 { |
| 124 struct curl_slist *list; | 124 struct curl_slist *list; |
| 125 | 125 |
| 126 curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); | 126 curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); |
| 127 | 127 |
| 190 { | 190 { |
| 191 SetType(type); | 191 SetType(type); |
| 192 } | 192 } |
| 193 | 193 |
| 194 RequestThread::RequestThread(const std::string &url, const std::vector<std::string> &headers, const std::string &data, | 194 RequestThread::RequestThread(const std::string &url, const std::vector<std::string> &headers, const std::string &data, |
| 195 Type type, QObject *parent) | 195 Type type, QObject *parent) |
| 196 : QThread(parent) | 196 : QThread(parent) |
| 197 { | 197 { |
| 198 SetUrl(url); | 198 SetUrl(url); |
| 199 SetData(data); | 199 SetData(data); |
| 200 SetHeaders(headers); | 200 SetHeaders(headers); |
| 201 SetType(type); | 201 SetType(type); |
