summaryrefslogtreecommitdiff
path: root/zen/http.h
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-10-11 11:16:39 -0400
committerB. Stack <bgstack15@gmail.com>2022-10-11 11:16:39 -0400
commitcab22f2dc3c5f41b5163f74cbb233e390edff6ff (patch)
treea49cfd729d9793681a57fa6f7409b0f0848e9ede /zen/http.h
parentMerge branch 'b11.25' into 'master' (diff)
downloadFreeFileSync-cab22f2dc3c5f41b5163f74cbb233e390edff6ff.tar.gz
FreeFileSync-cab22f2dc3c5f41b5163f74cbb233e390edff6ff.tar.bz2
FreeFileSync-cab22f2dc3c5f41b5163f74cbb233e390edff6ff.zip
add upstream 11.26
Diffstat (limited to 'zen/http.h')
-rw-r--r--zen/http.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/zen/http.h b/zen/http.h
index 5e40db22..ebbb8bd8 100644
--- a/zen/http.h
+++ b/zen/http.h
@@ -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);
bgstack15