summaryrefslogtreecommitdiff
path: root/wx+/http.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <shieldwed@outlook.com>2017-01-08 18:21:23 +0100
committerDaniel Wilhelm <shieldwed@outlook.com>2017-01-08 18:21:23 +0100
commitfe660cdff59aa3a939479ed60172e5c0803552b2 (patch)
tree045cf295b79de10f75ed6362c5836db25c9fc63a /wx+/http.h
parent8.6 (diff)
downloadFreeFileSync-fe660cdff59aa3a939479ed60172e5c0803552b2.tar.gz
FreeFileSync-fe660cdff59aa3a939479ed60172e5c0803552b2.tar.bz2
FreeFileSync-fe660cdff59aa3a939479ed60172e5c0803552b2.zip
8.7
Diffstat (limited to 'wx+/http.h')
-rw-r--r--wx+/http.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/wx+/http.h b/wx+/http.h
index febe8f24..cf385d5e 100644
--- a/wx+/http.h
+++ b/wx+/http.h
@@ -17,9 +17,32 @@ namespace zen
Windows: WinInet-based => may be called from worker thread
Linux: wxWidgets-based => don't call from worker thread
*/
-std::string sendHttpPost(const std::wstring& url, const std::wstring& userAgent, const std::vector<std::pair<std::string, std::string>>& postParams); //throw SysError
-std::string sendHttpGet (const std::wstring& url, const std::wstring& userAgent); //throw SysError
+class HttpInputStream
+{
+public:
+ std::string readAll(); //throw SysError
+
+ //support 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 { return 64 * 1024; }
+
+ class Impl;
+ HttpInputStream(std::unique_ptr<Impl>&& pimpl);
+ HttpInputStream(HttpInputStream&&) = default;
+ ~HttpInputStream();
+
+private:
+ std::unique_ptr<Impl> pimpl_;
+};
+
+
+HttpInputStream sendHttpGet (const std::wstring& url, const std::wstring& userAgent); //throw SysError
+HttpInputStream sendHttpPost(const std::wstring& url, const std::wstring& userAgent,
+ const std::vector<std::pair<std::string, std::string>>& postParams); //throw SysError
bool internetIsAlive(); //noexcept
+
+std::string xWwwFormUrlEncode(const std::vector<std::pair<std::string, std::string>>& paramPairs);
+std::vector<std::pair<std::string, std::string>> xWwwFormUrlDecode(const std::string& str);
}
#endif //HTTP_h_879083425703425702
bgstack15