diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2017-02-13 21:25:04 -0700 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2017-02-13 21:25:04 -0700 |
commit | 9d071d2a2cec9a7662a02669488569a017f0ea35 (patch) | |
tree | c83a623fbdff098339b66d21ea2e81f3f67344ae /wx+/http.h | |
parent | 8.8 (diff) | |
download | FreeFileSync-9d071d2a2cec9a7662a02669488569a017f0ea35.tar.gz FreeFileSync-9d071d2a2cec9a7662a02669488569a017f0ea35.tar.bz2 FreeFileSync-9d071d2a2cec9a7662a02669488569a017f0ea35.zip |
8.9
Diffstat (limited to 'wx+/http.h')
-rwxr-xr-x[-rw-r--r--] | wx+/http.h | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/wx+/http.h b/wx+/http.h index cf385d5e..97341e18 100644..100755 --- a/wx+/http.h +++ b/wx+/http.h @@ -1,48 +1,49 @@ -// ***************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * -// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved * -// ***************************************************************************** - -#ifndef HTTP_h_879083425703425702 -#define HTTP_h_879083425703425702 - -#include <zen/file_error.h> - -namespace zen -{ -/* - TREAD-SAFETY - ------------ - Windows: WinInet-based => may be called from worker thread - Linux: wxWidgets-based => don't call from worker thread -*/ -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 +// *****************************************************************************
+// * This file is part of the FreeFileSync project. It is distributed under *
+// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 *
+// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved *
+// *****************************************************************************
+
+#ifndef HTTP_h_879083425703425702
+#define HTTP_h_879083425703425702
+
+#include <zen/file_error.h>
+#include <zen/serialize.h>
+
+namespace zen
+{
+/*
+ TREAD-SAFETY
+ ------------
+ Windows: WinInet-based => may be called from worker thread
+ Linux: wxWidgets-based => don't call from 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
+
+ size_t getBlockSize() const;
+
+ 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, const IOCallback& notifyUnbufferedIO); //throw SysError
+HttpInputStream sendHttpPost(const std::wstring& url, const std::wstring& userAgent, const IOCallback& notifyUnbufferedIO,
+ 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
|