diff options
author | B. Stack <bgstack15@gmail.com> | 2022-10-11 15:17:59 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-10-11 15:17:59 +0000 |
commit | 38c826621a39831d1bdc78aa9e45cc592db3e77f (patch) | |
tree | a49cfd729d9793681a57fa6f7409b0f0848e9ede /zen/http.h | |
parent | Merge branch 'b11.25' into 'master' (diff) | |
parent | add upstream 11.26 (diff) | |
download | FreeFileSync-38c826621a39831d1bdc78aa9e45cc592db3e77f.tar.gz FreeFileSync-38c826621a39831d1bdc78aa9e45cc592db3e77f.tar.bz2 FreeFileSync-38c826621a39831d1bdc78aa9e45cc592db3e77f.zip |
Merge branch 'b11.26' into 'master'11.26
add upstream 11.26
See merge request opensource-tracking/FreeFileSync!49
Diffstat (limited to 'zen/http.h')
-rw-r--r-- | zen/http.h | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -12,17 +12,18 @@ namespace zen { -/* - thread-safe! (Window/Linux/macOS) - - Linux/macOS: init libcurl before use! */ +/* - Linux/macOS: init libcurl before use! + - safe to use on worker thread */ class HttpInputStream { public: - //support zen/serialize.h buffered input stream concept - size_t read(void* buffer, size_t bytesToRead); //throw SysError, X; return "bytesToRead" bytes unless end of stream! - std::string readAll(); //throw SysError, X + //zen/serialize.h unbuffered input stream concept: + size_t tryRead(void* buffer, size_t bytesToRead); //throw SysError; may return short; only 0 means EOF! CONTRACT: bytesToRead > 0! size_t getBlockSize() const; + std::string readAll(const IoCallback& notifyUnbufferedIO /*throw X*/); //throw SysError, X + class Impl; HttpInputStream(std::unique_ptr<Impl>&& pimpl); HttpInputStream(HttpInputStream&&) noexcept = default; @@ -35,20 +36,17 @@ private: HttpInputStream sendHttpGet(const Zstring& url, const Zstring& userAgent, - const Zstring& caCertFilePath /*optional: enable certificate validation*/, - const IoCallback& notifyUnbufferedIO /*throw X*/); //throw SysError, X + const Zstring& caCertFilePath /*optional: enable certificate validation*/); //throw SysError HttpInputStream sendHttpPost(const Zstring& url, - const std::vector<std::pair<std::string, std::string>>& postParams, + const std::vector<std::pair<std::string, std::string>>& postParams, const IoCallback& notifyUnbufferedIO /*throw X*/, const Zstring& userAgent, - const Zstring& caCertFilePath /*optional: enable certificate validation*/, - const IoCallback& notifyUnbufferedIO /*throw X*/); //throw SysError, X + const Zstring& caCertFilePath /*optional: enable certificate validation*/); //throw SysError, X HttpInputStream sendHttpPost(const Zstring& url, - const std::string& postBuf, const std::string& contentType, + const std::string& postBuf, const std::string& contentType, const IoCallback& notifyUnbufferedIO /*throw X*/, const Zstring& userAgent, - const Zstring& caCertFilePath /*optional: enable certificate validation*/, - const IoCallback& notifyUnbufferedIO /*throw X*/); //throw SysError, X + const Zstring& caCertFilePath /*optional: enable certificate validation*/); //throw SysError, X bool internetIsAlive(); //noexcept std::wstring formatHttpError(int httpStatus); |