Mercurial > minori
comparison include/core/http.h @ 397:811697ad826a
http: do proper global init/cleanup of libcurl
this is done automagically using RAII
| author | Paper <paper@tflc.us> |
|---|---|
| date | Fri, 07 Nov 2025 08:39:24 -0500 |
| parents | 963047512d34 |
| children |
comparison
equal
deleted
inserted
replaced
| 396:8ed3b5e8f205 | 397:811697ad826a |
|---|---|
| 8 #include <mutex> | 8 #include <mutex> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 namespace HTTP { | 12 namespace HTTP { |
| 13 | |
| 14 /* Global state init/quit */ | |
| 15 void Init(); | |
| 16 void Quit(); | |
| 17 | |
| 18 /* helper class that automatically init/deinit as constructors | |
| 19 * and destructors */ | |
| 20 struct Initializer { | |
| 21 Initializer() { Init(); } | |
| 22 ~Initializer() { Quit(); } | |
| 23 }; | |
| 13 | 24 |
| 14 /* calls libcurl to encode/decode */ | 25 /* calls libcurl to encode/decode */ |
| 15 std::string UrlEncode(const std::string &data); | 26 std::string UrlEncode(const std::string &data); |
| 16 std::string UrlDecode(const std::string &data); | 27 std::string UrlDecode(const std::string &data); |
| 17 | 28 |
